ldap.syncrepl
Implementation of a syncrepl consumer¶
See also
RFC 4533 - Lightweight Directory Access Protocol (v3): Content Synchronization Operation
This requires pyasn1
and pyasn1_modules
to be installed.
Classes¶
This module defines the following classes:
-
class
ldap.syncrepl.
SyncreplConsumer
¶ SyncreplConsumer - LDAP syncrepl consumer object.
-
syncrepl_delete
(uuids)¶ Called by syncrepl_poll() to delete entries. A list of UUIDs of the entries to be deleted is given in the uuids parameter.
-
syncrepl_entry
(dn, attrs, uuid)¶ Called by syncrepl_poll() for any added or modified entries.
The provided uuid is used to identify the provided entry in any future modification (including dn modification), deletion, and presentation operations.
Called by syncrepl_search() to retrieve the cookie stored by syncrepl_set_cookie()
-
syncrepl_poll
(msgid=-1, timeout=None, all=0)¶ polls for and processes responses to the syncrepl_search() operation. Returns False when operation finishes, True if it is in progress, or raises an exception on error.
If timeout is specified, raises ldap.TIMEOUT in the event of a timeout.
If all is set to a nonzero value, poll() will return only when finished or when an exception is raised.
-
syncrepl_present
(uuids, refreshDeletes=False)¶ Called by syncrepl_poll() whenever entry UUIDs are presented to the client. syncrepl_present() is given a list of entry UUIDs (uuids) and a flag (refreshDeletes) which indicates whether the server explicitly deleted non-present entries during the refresh operation.
If called with a list of uuids, the syncrepl_present() implementation should record those uuids as present in the directory.
If called with uuids set to None and refreshDeletes set to False, syncrepl_present() should delete all non-present entries from the local mirror, and reset the list of recorded uuids.
If called with uuids set to None and refreshDeletes set to True, syncrepl_present() should reset the list of recorded uuids, without deleting any entries.
-
syncrepl_refreshdone
()¶ Called by syncrepl_poll() between refresh and persist phase.
It indicates that initial synchronization is done and persist phase follows.
-
syncrepl_search
(base, scope, mode='refreshOnly', cookie=None, **search_args)¶ Starts syncrepl search operation.
base, scope, and search_args are passed along to self.search_ext unmodified (aside from adding a Sync Request control to any serverctrls provided).
mode provides syncrepl mode. Can be ‘refreshOnly’ to finish after synchronization, or ‘refreshAndPersist’ to persist (continue to receive updates) after synchronization.
cookie: an opaque value representing the replication state of the client. Subclasses should override the syncrepl_set_cookie() and syncrepl_get_cookie() methods to store the cookie appropriately, rather than passing it.
Only a single syncrepl search may be active on a SyncreplConsumer object. Multiple concurrent syncrepl searches require multiple separate SyncreplConsumer objects and thus multiple connections (LDAPObject instances).
Called by syncrepl_poll() to store a new cookie provided by the server.
-