初始化

初始化先构造Pegasus对象,在使用init函数完成初始化:

  1. class Pegasus(object):
  2. """
  3. Pegasus client class.
  4. """
  5. def __init__(self, meta_addrs=None, table_name='',
  6. timeout=DEFAULT_TIMEOUT):
  7. """
  8. :param meta_addrs: (list) pagasus meta servers list.
  9. example: ['127.0.0.1:34601', '127.0.0.1:34602', '127.0.0.1:34603']
  10. :param table_name: (str) table name/app name used in pegasus.
  11. :param timeout: (int) default timeout in milliseconds when communicate with meta sever and replica server.
  12. """
  1. def init(self):
  2. """
  3. Initialize the client before you can use it.
  4. :return: (DeferredList) True when initialized succeed, others when failed.
  5. """