當前位置: 首頁>>代碼示例>>Python>>正文


Python LocalDbHandler.buffer_real_operation方法代碼示例

本文整理匯總了Python中pydio.job.localdb.LocalDbHandler.buffer_real_operation方法的典型用法代碼示例。如果您正苦於以下問題:Python LocalDbHandler.buffer_real_operation方法的具體用法?Python LocalDbHandler.buffer_real_operation怎麽用?Python LocalDbHandler.buffer_real_operation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pydio.job.localdb.LocalDbHandler的用法示例。


在下文中一共展示了LocalDbHandler.buffer_real_operation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ContinuousDiffMerger

# 需要導入模塊: from pydio.job.localdb import LocalDbHandler [as 別名]
# 或者: from pydio.job.localdb.LocalDbHandler import buffer_real_operation [as 別名]

#.........這裏部分代碼省略.........
        return False

    def process_remoteMOVE(self, source, target):
        self.info('MOVE ============> ' + source + ' to ' + target, toUser=False)
        self.sdk.rename(source, target)

    def process_DOWNLOAD(self, path):
        self.db_handler.update_node_status(path, 'DOWN')
        self.sdk.download(path, self.basepath + path)
        self.db_handler.update_node_status(path, 'IDLE')
        self.info(path + ' <=============== ' + path, 'File ' + path + ' downloaded from server')

    def process_UPLOAD(self, path):
        self.db_handler.update_node_status(path, 'UP')
        self.sdk.upload(self.basepath+path, self.system.stat(path), path)
        self.db_handler.update_node_status(path, 'IDLE')
        self.info(path + ' ===============> ' + path, 'File ' + path + ' uploaded to server')


    def process_change(self, item):

        location = item['location']
        if self.direction == 'up' and location == 'remote':
            return
        if self.direction == 'down' and location == 'local':
            return

        if item['type'] == 'create' or item['type'] == 'content':
            if item['node']['md5'] == 'directory':
                if item['node']['node_path']:
                    logging.info('[' + location + '] Create folder ' + item['node']['node_path'])
                    if location == 'remote':
                        self.process_localMKDIR(item['node']['node_path'])
                        self.db_handler.buffer_real_operation(item['type'], 'NULL', item['node']['node_path'])
                    else:
                        self.process_remoteMKDIR(item['node']['node_path'])
            else:
                if item['node']['node_path']:
                    if location == 'remote':
                        self.process_DOWNLOAD(item['node']['node_path'])
                        if item['type'] == 'create':
                            self.db_handler.buffer_real_operation(item['type'], 'NULL', item['node']['node_path'])
                        else:
                            self.db_handler.buffer_real_operation(item['type'], item['node']['node_path'], item['node']['node_path'])
                    else:
                        self.process_UPLOAD(item['node']['node_path'])

        elif item['type'] == 'delete':
            logging.info('[' + location + '] Should delete ' + item['source'])
            if location == 'remote':
                self.process_localDELETE(item['source'])
                self.db_handler.buffer_real_operation('delete', item['source'], 'NULL')
            else:
                self.process_remoteDELETE(item['source'])

        else:
            logging.info('[' + location + '] Should move ' + item['source'] + ' to ' + item['target'])
            if location == 'remote':
                if os.path.exists(self.basepath + item['source']):
                    if self.process_localMOVE(item['source'], item['target']):
                        self.db_handler.buffer_real_operation(item['type'], item['source'], item['target'])
                else:
                    if item["node"]["md5"] == "directory":
                        logging.debug('Cannot find folder to move, switching to creation')
                        self.process_localMKDIR(item['target'])
                    else:
開發者ID:Acidburn0zzz,項目名稱:pydio-sync,代碼行數:70,代碼來源:continous_merger.py


注:本文中的pydio.job.localdb.LocalDbHandler.buffer_real_operation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。