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


Python LocalDbHandler.update_node_status方法代碼示例

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


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

示例1: post

# 需要導入模塊: from pydio.job.localdb import LocalDbHandler [as 別名]
# 或者: from pydio.job.localdb.LocalDbHandler import update_node_status [as 別名]
    def post(self):
        json_conflict = request.get_json()
        job_id = json_conflict['job_id']
        try:
            job_config = JobsLoader.Instance().get_job(job_id)
        except Exception:
            return "Can't find any job config with this ID.", 404

        dbHandler = LocalDbHandler(JobsLoader.Instance().build_job_data_path(job_id))
        dbHandler.update_node_status(json_conflict['node_path'], json_conflict['status'])
        if not dbHandler.count_conflicts() and job_config.active:
            t = PydioScheduler.Instance().get_thread(job_id)
            if t:
                t.start_now()
        return json_conflict
開發者ID:7omate,項目名稱:pydio-sync,代碼行數:17,代碼來源:web_api.py

示例2: ContinuousDiffMerger

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

#.........這裏部分代碼省略.........
                # IDLE (here, just before we reduce changes)
                #  |
                # PENDING (those files/folders which remain after reducing changes and to be actually processed)
                #  |
                # UP / DOWN / CONFLICT (corresponding the operation which occurs)
                #  |
                # IDLE (The final state once upload/ download happens or once when the conflict is resolved)
                self.db_handler.update_bulk_node_status_as_idle()

                logging.debug('[CMERGER] Delete Copies ' + self.job_config.id)
                self.current_store.delete_copies()
                self.update_min_seqs_from_store()
                logging.debug('[CMERGER] Dedup changes ' + self.job_config.id)
                self.current_store.dedup_changes()
                self.update_min_seqs_from_store()
                if not self.storage_watcher or very_first:
                    logging.debug('[CMERGER] Detect unnecessary changes ' + self.ws_id)
                    self.logger.log_state(_('Detecting unecessary changes...'), 'sync')
                    self.current_store.detect_unnecessary_changes()
                    logging.debug('[CMERGER] Done detecting unnecessary changes')
                    self.logger.log_state(_('Done detecting unecessary changes...'), 'sync')
                self.update_min_seqs_from_store()
                logging.debug('Clearing op and pruning folders moves ' + self.job_config.id)
                self.current_store.clear_operations_buffer()
                self.current_store.prune_folders_moves()
                self.update_min_seqs_from_store()

                logging.debug('Store conflicts ' + self.job_config.id)
                store_conflicts = self.current_store.clean_and_detect_conflicts(self.db_handler)
                if store_conflicts:
                    if self.job_config.solve == 'both':
                        logging.info('Marking nodes SOLVED:KEEPBOTH')
                        for row in self.db_handler.list_conflict_nodes():
                            self.db_handler.update_node_status(row['node_path'], 'SOLVED:KEEPBOTH')
                        store_conflicts = self.current_store.clean_and_detect_conflicts(self.db_handler)
                if store_conflicts:
                    logging.info('Conflicts detected, cannot continue!')
                    self.logger.log_state(_('Conflicts detected, cannot continue!'), 'error')
                    self.current_store.close()
                    self.sleep_offline()
                    self.logger.log_notif(_('Conflicts detected, cannot continue!'), 'error')
                    continue

                if self.job_config.direction == 'down' and self.job_config.solve != 'remote':
                    self.current_store.remove_based_on_location('local')
                    self.update_min_seqs_from_store()

                changes_length = len(self.current_store)
                if not changes_length:
                    logging.info('No changes detected for ' + self.job_config.id)
                    self.exit_loop_clean(self.logger)
                    very_first = False
                    continue

                self.current_store.update_pending_status(self.db_handler, self.local_seq)

                self.global_progress['status_indexing'] = 0
                import change_processor
                self.global_progress['queue_length'] = changes_length
                logging.info('Processing %i changes' % changes_length)
                self.logger.log_state(_('Processing %i changes') % changes_length, "start")
                counter = [1]
                def processor_callback(change):
                    try:
                        if self.interrupt or not self.job_status_running:
                            raise InterruptException()
開發者ID:DepaMarco,項目名稱:pydio-sync,代碼行數:70,代碼來源:continous_merger.py

示例3: ContinuousDiffMerger

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

#.........這裏部分代碼省略.........
        self.info(message, 'New folder created at '+ path )

    def process_remoteMKDIR(self, path):
        message = 'MKDIR ============> ' + path
        self.info(message, toUser=False)
        self.sdk.mkdir(path)

    def process_localDELETE(self, path):
        if os.path.isdir(self.basepath + path):
            self.system.rmdir(path)
            self.info(path + ' <============ DELETE', 'Deleted folder ' + path)
        elif os.path.isfile(self.basepath + path):
            os.unlink(self.basepath + path)
            self.info(path + ' <============ DELETE', 'Deleted file ' + path)

    def process_remoteDELETE(self, path):
        self.sdk.delete(path)
        self.info('DELETE ============> ' + path, False)

    def process_localMOVE(self, source, target):
        if os.path.exists(self.basepath + source):
            if not os.path.exists(self.basepath + os.path.dirname(target)):
                os.makedirs(self.basepath + os.path.dirname(target))
            os.rename(self.basepath + source, self.basepath + target)
            self.info(source + ' to ' + target + ' <============ MOVE', 'Moved ' + source + ' to ' + target)
            return True
        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'])
開發者ID:Acidburn0zzz,項目名稱:pydio-sync,代碼行數:70,代碼來源:continous_merger.py


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