New hook syncrepl_refreshdone() in ldap.syncrepl.SyncReplConsumer (thanks to Petr Spacek)
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -4,7 +4,8 @@ Released 2.4.17 2014-xx-xx
|
|||||||
Changes since 2.4.16:
|
Changes since 2.4.16:
|
||||||
|
|
||||||
Lib/
|
Lib/
|
||||||
*
|
* New hook syncrepl_refreshdone() in ldap.syncrepl.SyncReplConsumer
|
||||||
|
(thanks to Petr Spacek)
|
||||||
|
|
||||||
Modules/
|
Modules/
|
||||||
* Added support for getting file descriptor of connection
|
* Added support for getting file descriptor of connection
|
||||||
@@ -1122,4 +1123,4 @@ Released 2.0.0pre02 2002-02-01
|
|||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Released 1.10alpha3 2000-09-19
|
Released 1.10alpha3 2000-09-19
|
||||||
|
|
||||||
$Id: CHANGES,v 1.326 2014/09/12 12:02:21 stroeder Exp $
|
$Id: CHANGES,v 1.327 2014/09/25 16:31:00 stroeder Exp $
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ class SyncReplConsumer(ReconnectLDAPObject,SyncreplConsumer):
|
|||||||
for uuid in uuids:
|
for uuid in uuids:
|
||||||
self.__presentUUIDs[uuid] = True
|
self.__presentUUIDs[uuid] = True
|
||||||
|
|
||||||
|
def syncrepl_refreshdone(self):
|
||||||
|
print 'Initial synchronization is now done, persist phase begins'
|
||||||
|
|
||||||
def perform_application_sync(self,dn,attributes,previous_attributes):
|
def perform_application_sync(self,dn,attributes,previous_attributes):
|
||||||
print 'Performing application sync for:', dn
|
print 'Performing application sync for:', dn
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ ldap.syncrepl - for implementing syncrepl consumer (see RFC 4533)
|
|||||||
|
|
||||||
See http://www.python-ldap.org/ for project details.
|
See http://www.python-ldap.org/ for project details.
|
||||||
|
|
||||||
$Id: syncrepl.py,v 1.3 2012/08/09 07:18:31 stroeder Exp $
|
$Id: syncrepl.py,v 1.4 2014/09/25 16:31:00 stroeder Exp $
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#__all__ = [
|
#__all__ = [
|
||||||
@@ -330,6 +330,11 @@ class SyncreplConsumer:
|
|||||||
self.__refreshDone = False
|
self.__refreshDone = False
|
||||||
return self.search_ext(base, scope, **search_args)
|
return self.search_ext(base, scope, **search_args)
|
||||||
|
|
||||||
|
def _syncrepl_update_refreshdone(self, newvalue):
|
||||||
|
callback = newvalue and not self.__refreshDone
|
||||||
|
self.__refreshDone = newvalue
|
||||||
|
if callback:
|
||||||
|
self.syncrepl_refreshdone()
|
||||||
|
|
||||||
def syncrepl_poll(self, msgid=-1, timeout=None, all=0):
|
def syncrepl_poll(self, msgid=-1, timeout=None, all=0):
|
||||||
"""
|
"""
|
||||||
@@ -394,12 +399,12 @@ class SyncreplConsumer:
|
|||||||
self.syncrepl_present(None, refreshDeletes=False)
|
self.syncrepl_present(None, refreshDeletes=False)
|
||||||
if 'cookie' in sim.refreshPresent:
|
if 'cookie' in sim.refreshPresent:
|
||||||
self.syncrepl_set_cookie(sim.refreshPresent['cookie'])
|
self.syncrepl_set_cookie(sim.refreshPresent['cookie'])
|
||||||
self.__refreshDone=sim.refreshPresent['refreshDone']
|
self._syncrepl_update_refreshdone(sim.refreshPresent['refreshDone'])
|
||||||
elif sim.refreshDelete is not None:
|
elif sim.refreshDelete is not None:
|
||||||
self.syncrepl_present(None, refreshDeletes=True)
|
self.syncrepl_present(None, refreshDeletes=True)
|
||||||
if 'cookie' in sim.refreshDelete:
|
if 'cookie' in sim.refreshDelete:
|
||||||
self.syncrepl_set_cookie(sim.refreshDelete['cookie'])
|
self.syncrepl_set_cookie(sim.refreshDelete['cookie'])
|
||||||
self.__refreshDone=sim.refreshDelete['refreshDone']
|
self._syncrepl_update_refreshdone(sim.refreshDelete['refreshDone'])
|
||||||
elif sim.syncIdSet is not None:
|
elif sim.syncIdSet is not None:
|
||||||
if sim.syncIdSet['refreshDeletes'] is True:
|
if sim.syncIdSet['refreshDeletes'] is True:
|
||||||
self.syncrepl_delete(sim.syncIdSet['syncUUIDs'])
|
self.syncrepl_delete(sim.syncIdSet['syncUUIDs'])
|
||||||
@@ -467,3 +472,12 @@ class SyncreplConsumer:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def syncrepl_refreshdone(self):
|
||||||
|
"""
|
||||||
|
Called by syncrepl_poll() between refresh and persist phase.
|
||||||
|
|
||||||
|
It indicates that initial synchronization is done and persist phase
|
||||||
|
follows.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user