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


Python LocalDbHandler.get_max_seq方法代碼示例

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


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

示例1: ContinuousDiffMerger

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

#.........這裏部分代碼省略.........
            except Timeout as to:
                logging.error(to)
                self.logger.log_state(_('Connection timeout, will retry later.'), 'error')
            except RequestException as ree:
                logging.error(ree.message)
                self.logger.log_state(_('Cannot resolve domain!'), 'error')
                self.sleep_offline()
            except PydioSdkBasicAuthException as e:
                self.logger.log_state(_('Authentication Error'), 'error')
                self.logger.log_notif(_('Authentication Error'), 'error')
                self.sleep_offline()
            except Exception as e:
                if not (e.message.lower().count('[quota limit reached]') or e.message.lower().count('[file permissions]')):
                    logging.exception('Unexpected Error: %s' % e.message)
                    self.logger.log_state(_('Unexpected Error: %s') % e.message, 'error')
                else:
                    logging.exception(e)
                self.sleep_offline()
            logging.debug('Finished this cycle, waiting for %i seconds' % self.online_timer)
            very_first = False

    def start_watcher(self):
        if self.watcher:
            if self.watcher_first_run:
                def status_callback(status):
                    self.logger.log_state(status, 'sync')
                self.init_global_progress()

                try:
                    self.global_progress['status_indexing'] = 1
                    self.logger.log_state(_('Checking changes since last launch...'), "sync")
                    very_first = True
                    self.db_handler.update_bulk_node_status_as_idle()
                    self.watcher.check_from_snapshot(state_callback=status_callback)
                except DBCorruptedException as e:
                    self.stop()
                    JobsLoader.Instance().clear_job_data(self.job_config.id)
                    logging.error(e)
                    return
                except Exception as e:
                    logging.exception(e)
                    self.interrupt = True
                    self.logger.log_state(_('Oops, error while indexing the local folder. Pausing the task.'), 'error')
                    logging.error(e)

                self.watcher_first_run = False
            self.watcher.start()

    @pydio_profile
    def update_min_seqs_from_store(self, success=False):
        self.local_seq = self.current_store.get_min_seq('local', success=success)
        if self.local_seq == -1:
            self.local_seq = self.local_target_seq
        self.remote_seq = self.current_store.get_min_seq('remote', success=success)
        if self.remote_seq == -1:
            self.remote_seq = self.remote_target_seq
        #logging.info('Storing sequences remote=%i local=%i', self.remote_seq, self.local_seq)
        self.update_sequences_file(self.local_seq, self.remote_seq)
        if self.event_handler:
            self.event_handler.last_seq_id = self.local_seq

    @pydio_profile
    def ping_remote(self):
        """
        Simple stat of the remote server root, to know if it's reachable.
        :return:bool
        """
        test = self.sdk.stat('/')
        return (test != False)

    def info(self, message, toUser=False, channel='sync'):
        logging.info(message)
        if toUser:
            dispatcher.send(signal=PUBLISH_SIGNAL, sender=self, channel=channel, message=message)

    @pydio_profile
    def load_remote_changes_in_store(self, seq_id, store):
        last_seq = self.sdk.changes_stream(seq_id, store.flatten_and_store)
        if self.wait_for_changes:
            timereq = time.time()
            try:
                if self.sdk.waiter is None:
                    self.sdk.websocket_connect(last_seq, str(self.job_config.id))

                if self.sdk.waiter and self.sdk.waiter.ws.connected:
                    self.sdk.waiter.should_fetch_changes = False
                    while not self.sdk.waiter.should_fetch_changes and not self.interrupt:
                        time.sleep(2)
                        # these break only after one run
                        if self.local_seq != self.db_handler.get_max_seq():
                            # There was a local change
                            break
                        if not self.sdk.waiter.ws.connected:
                            # websocket disconnected
                            break
            except Exception as e:
                logging.exception(e)
            if time.time() - timereq > 10:  # if last_seq was updated more than 10s ago, update it
                last_seq = self.sdk.changes_stream(seq_id, store.flatten_and_store)
        return last_seq
開發者ID:,項目名稱:,代碼行數:104,代碼來源:


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