def __init__(self, host, port, db_name, username=None, password=None, https=False): common.ConnectionManager.__init__(self) log.LogProxy.__init__(self, log.get_default() or log.FluLogKeeper()) ChangeListener.__init__(self, self) self.couchdb = None self.db_name = None self.version = None self.host = None self.port = None self.https = None # name -> Notifier self.notifiers = dict() # this flag is prevents reconnector from being spawned self.disconnected = False self.retry = 0 self.reconnector = None # doc_id -> list of tuples (Filter, rev, deleted) # The list is added when we start modifying the document, # all the notificactions received in the meantime will be # stored in this hash, until change is done, this solves # the problem with caused by change notification received # before the http request modifying the document is finished self._pending_notifications = dict() # doc_id -> C{int} number of locks self._document_locks = dict() self._cache = Cache(desired_size=self.DESIRED_CACHE_SIZE) self._configure(host, port, db_name, username, password, https)
def __init__(self, host, port, db_name): common.ConnectionManager.__init__(self) log.LogProxy.__init__(self, log.get_default() or log.FluLogKeeper()) ChangeListener.__init__(self, self) self.paisley = None self.db_name = None self.host = None self.port = None # name -> Notifier self.notifiers = dict() self.retry = 0 self.reconnector = None # doc_id -> list of tuples (Filter, rev, deleted) # The list is added when we start modifying the document, # all the notificactions received in the meantime will be # stored in this hash, until change is done, this solves # the problem with caused by change notification received # before the http request modifying the document is finished self._pending_notifications = dict() # doc_id -> C{int} number of locks self._document_locks = dict() self._configure(host, port, db_name)
def __init__(self): common.ConnectionManager.__init__(self) log.LogProxy.__init__(self, log.get_default() or log.FluLogKeeper()) ChangeListener.__init__(self, self) common.Statistics.__init__(self) # id -> document self._documents = {} # id -> name -> body self._attachments = {} # id -> view_name -> (key, value) self._view_cache = {} self._on_connected() # type_name -> int, used for generating nice agent IDs in # simulations self._doc_type_counters = dict() # list of all old revisions self._changes = list()