本文整理匯總了Python中pydio.job.localdb.LocalDbHandler.get_last_operations方法的典型用法代碼示例。如果您正苦於以下問題:Python LocalDbHandler.get_last_operations方法的具體用法?Python LocalDbHandler.get_last_operations怎麽用?Python LocalDbHandler.get_last_operations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pydio.job.localdb.LocalDbHandler
的用法示例。
在下文中一共展示了LocalDbHandler.get_last_operations方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ContinuousDiffMerger
# 需要導入模塊: from pydio.job.localdb import LocalDbHandler [as 別名]
# 或者: from pydio.job.localdb.LocalDbHandler import get_last_operations [as 別名]
#.........這裏部分代碼省略.........
for seq_id in remote_sequences:
otheritem = remote_changes['data'][seq_id]
try:
if not (item['type'] == otheritem['type']):
continue
if not item['node'] and not otheritem['node'] and (item['source'] == otheritem['source']):
logging.debug('Reconciliation sequence for change (source)'+item['source'])
lchanges.remove(item)
rchanges.remove(otheritem)
self.remove_seq(item['seq'], 'local')
self.remove_seq(otheritem['seq'], 'remote')
break
if not (os.path.normpath(item['node']['node_path']) == os.path.normpath(otheritem['node']['node_path'])):
continue
if item['node']['bytesize'] == otheritem['node']['bytesize'] and item['node']['md5'] == otheritem['node']['md5']:
logging.debug('Reconciliation sequence for change (node)'+item['node']['node_path'])
lchanges.remove(item)
rchanges.remove(otheritem)
self.remove_seq(item['seq'], 'local')
self.remove_seq(otheritem['seq'], 'remote')
break
except Exception as e:
pass
test_stats = list(set(map(lambda it: it['source'] if it['source'] != 'NULL' else it['target'], lchanges)))
remote_stats = None
if len(test_stats):
remote_stats = self.sdk.bulk_stat(test_stats, with_hash=True)
rchanges = filter(lambda it: not self.filter_change(it, remote_stats, None), rchanges)
lchanges = filter(lambda it: not self.filter_change(it, None, remote_stats), lchanges)
last_ops = self.db_handler.get_last_operations()
new_rchanges = []
for item in lchanges:
ignore = False
for last in last_ops:
if last['type'] == item['type'] and last['source'] == item['source'] and last['target'] == item['target']:
logging.info('IGNORING, RECENT MOVE FROM SERVER', last)
ignore = True
break
if ignore:
continue
conflict = False
for rItem in rchanges:
if (not item['node'] and not rItem['node'] and rItem['source'] == rItem['source']) or (item['node'] and rItem['node'] and item['node']['node_path'] and rItem['node']['node_path'] and os.path.normpath(item['node']['node_path']) == os.path.normpath(rItem['node']['node_path'])):
# Seems there is a conflict - check
c_path = item['source']
if item['node']:
c_path = item['node']['node_path']
status = self.db_handler.get_node_status(c_path)
if status == 'SOLVED:KEEPLOCAL':
rchanges.remove(rItem)
elif status == 'SOLVED:KEEPREMOTE':
conflict = True
else:
conflict = True
rchanges.remove(rItem)
conflicts.append({'local':item,'remote':rItem})
break
if conflict:
continue
new_rchanges.append(item)