本文整理匯總了Python中pydio.job.localdb.LocalDbHandler.get_local_changes方法的典型用法代碼示例。如果您正苦於以下問題:Python LocalDbHandler.get_local_changes方法的具體用法?Python LocalDbHandler.get_local_changes怎麽用?Python LocalDbHandler.get_local_changes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pydio.job.localdb.LocalDbHandler
的用法示例。
在下文中一共展示了LocalDbHandler.get_local_changes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ContinuousDiffMerger
# 需要導入模塊: from pydio.job.localdb import LocalDbHandler [as 別名]
# 或者: from pydio.job.localdb.LocalDbHandler import get_local_changes [as 別名]
#.........這裏部分代碼省略.........
if not self.job_status_running:
time.sleep(self.online_timer)
continue
if not self.system.check_basepath():
logging.info('Cannot find local folder! Did you disconnect a volume? Waiting %s seconds before retry' % self.offline_timer)
time.sleep(self.offline_timer)
continue
# Load local and/or remote changes, depending on the direction
local_changes = dict(data=dict(), path_to_seqs=dict())
remote_changes = dict(data=dict(), path_to_seqs=dict())
try:
if self.job_config.direction != 'up':
logging.info('Loading remote changes with sequence ' + str(self.remote_seq))
self.remote_target_seq = self.get_remote_changes(self.remote_seq, remote_changes)
else:
self.remote_target_seq = 1
self.ping_remote()
except ConnectionError as ce:
logging.info('No connection detected, waiting %s seconds to retry' % self.offline_timer)
self.online_status = False
time.sleep(self.offline_timer)
continue
except Exception as e:
logging.info('Error while connecting to remote server (%s), waiting for %i seconds before retempting ' % (e.message, self.offline_timer))
self.online_status = False
time.sleep(self.offline_timer)
continue
self.online_status = True
if self.job_config.direction != 'down':
logging.info('Loading local changes with sequence ' + str(self.local_seq))
self.local_target_seq = self.db_handler.get_local_changes(self.local_seq, local_changes)
else:
self.local_target_seq = 1
self.local_seqs = local_changes['data'].keys() #map(lambda x:x['seq'], local_changes)
self.remote_seqs = remote_changes['data'].keys() #map(lambda x:x['seq'], remote_changes)
logging.info('Reducing changes')
conflicts = []
changes = self.reduce_changes(local_changes, remote_changes, conflicts)
if len(conflicts):
logging.info('Conflicts detected, cannot continue!')
self.store_conflicts(conflicts)
self.job_status_running = False
time.sleep(self.offline_timer)
continue
if len(changes):
logging.info('Processing %i changes' % len(changes))
i = 1
for change in changes:
try:
self.process_change(change)
self.remove_seq(change['seq'], change['location'])
except ProcessException as pe:
logging.error(pe.message)
except OSError as e:
logging.error(e.message)
#progress_percent = 100 * i / len(changes)
progress_percent = "{0:.2f}%".format(float(i)/len(changes) * 100)
dispatcher.send(signal=PROGRESS_SIGNAL, sender=self, progress=progress_percent)
#self.pub_socket.send_string("sync" + ' ' + str(i) + "/" + str(len(changes)) + " changes done : " + str(progressPercent) + "%")
i += 1
if self.interrupt: