本文整理汇总了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: