当前位置: 首页>>代码示例>>Python>>正文


Python SQLiteCacheDB.initial_begin方法代码示例

本文整理汇总了Python中Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB.initial_begin方法的典型用法代码示例。如果您正苦于以下问题:Python SQLiteCacheDB.initial_begin方法的具体用法?Python SQLiteCacheDB.initial_begin怎么用?Python SQLiteCacheDB.initial_begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB的用法示例。


在下文中一共展示了SQLiteCacheDB.initial_begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Session

# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import initial_begin [as 别名]

#.........这里部分代码省略.........

        self.sessconfig = scfg.sessconfig
        self.sessconfig.lock = self.sesslock

        self.selected_ports = scfg.selected_ports

        # Claim all random ports
        self.get_listen_port()
        self.get_dispersy_port()
        self.get_mainline_dht_listen_port()
        self.get_videoplayer_port()

        self.get_anon_listen_port()
        self.get_tunnel_community_socks5_listen_ports()

        # Create handler for calling back the user via separate threads
        self.lm = TriblerLaunchMany()
        self.notifier = Notifier(use_pool=True)

        # Checkpoint startup config
        self.save_pstate_sessconfig()

        self.sqlite_db = None

        self.autoload_discovery = autoload_discovery

    def prestart(self):
        """
        Pre-starts the session. We check the current version and upgrade if needed
-        before we start everything else.
        """
        self.sqlite_db = SQLiteCacheDB(self)
        self.sqlite_db.initialize()
        self.sqlite_db.initial_begin()
        self.upgrader = TriblerUpgrader(self, self.sqlite_db)
        self.upgrader.run()
        return self.upgrader

    #
    # Class methods
    #
    @staticmethod
    def get_instance(*args, **kw):
        """ Returns the Session singleton if it exists or otherwise
            creates it first, in which case you need to pass the constructor
            params.
            @return Session."""
        if Session.__single is None:
            Session(*args, **kw)
        return Session.__single

    @staticmethod
    def has_instance():
        return Session.__single is not None

    @staticmethod
    def del_instance():
        Session.__single = None

    #
    # Public methods
    #
    def start_download(self, tdef, dcfg=None, initialdlstatus=None, hidden=False):
        """
        Creates a Download object and adds it to the session. The passed
        ContentDef and DownloadStartupConfig are copied into the new Download
开发者ID:Azzhag,项目名称:tribler,代码行数:70,代码来源:Session.py

示例2: test_failed_commit

# 需要导入模块: from Tribler.Core.CacheDB.sqlitecachedb import SQLiteCacheDB [as 别名]
# 或者: from Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB import initial_begin [as 别名]
 def test_failed_commit(self):
     sqlite_test_2 = SQLiteCacheDB(os.path.join(self.session_base_dir, "test_db.db"), DB_SCRIPT_ABSOLUTE_PATH)
     sqlite_test_2.initial_begin()
     sqlite_test_2.write_version(4)
开发者ID:synctext,项目名称:tribler,代码行数:6,代码来源:test_sqlitecachedb.py


注:本文中的Tribler.Core.CacheDB.sqlitecachedb.SQLiteCacheDB.initial_begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。