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


Python ClientStorage.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from ZEO.ClientStorage import ClientStorage [as 别名]
# 或者: from ZEO.ClientStorage.ClientStorage import __init__ [as 别名]
 def __init__(self, name, blob_dir, shared=False, extrafsoptions=""):
     if shared:
         server_blob_dir = blob_dir
     else:
         server_blob_dir = "server-" + blob_dir
     self.globs = {}
     port = forker.get_port2(self)
     addr, admin, pid, config = forker.start_zeo_server(
         """
         <blobstorage>
             blob-dir %s
             <filestorage>
                path %s
                %s
             </filestorage>
         </blobstorage>
         """
         % (server_blob_dir, name + ".fs", extrafsoptions),
         port=port,
     )
     os.remove(config)
     zope.testing.setupstack.register(self, os.waitpid, pid, 0)
     zope.testing.setupstack.register(self, forker.shutdown_zeo_server, admin)
     if shared:
         ClientStorage.__init__(self, addr, blob_dir=blob_dir, shared_blob_dir=True)
     else:
         ClientStorage.__init__(self, addr, blob_dir=blob_dir)
开发者ID:grodniewicz,项目名称:oship,代码行数:29,代码来源:testZEO.py

示例2: __init__

# 需要导入模块: from ZEO.ClientStorage import ClientStorage [as 别名]
# 或者: from ZEO.ClientStorage.ClientStorage import __init__ [as 别名]
    def __init__(self, addr, storage='1', cache_size=20 * MB,
                 name='', client=None, debug=0, var=None,
                 min_disconnect_poll=5, max_disconnect_poll=300,
                 wait_for_server_on_startup=None, # deprecated alias for wait
                 wait=None, wait_timeout=None,
                 read_only=0, read_only_fallback=0,
                 username='', password='', realm=None):


        # swap out the ClientCache with QonClientCache if desired.
        self.ClientCacheClass = ClientCache
        if qon.local.CACHE_INSTRUMENTATION:
            self.ClientCacheClass = QonClientCache
            
        ClientStorage.__init__(self, addr, storage, cache_size, \
                               name, client, debug, var, \
                               min_disconnect_poll, max_disconnect_poll, \
                               wait_for_server_on_startup, \
                               wait, wait_timeout, \
                               read_only, read_only_fallback, \
                               username, password, realm)

        # fix the cache_size bug that we manually patched previously.
        # once ZEO's code is fixed, we can remove everything after
        #  this line of code in this routine.
        if self._cache:
            self._cache.close()
            del self._cache

        # Decide whether to use non-temporary files
        if client is not None:
            dir = var or os.getcwd()
            cache_path = os.path.join(dir, "%s-%s.zec" % (client, storage))
        else:
            cache_path = None

        # create the cache            
        self._cache = self.ClientCacheClass(cache_path, size=cache_size) # this here is that actual cache_size fix
        self._cache.open()
开发者ID:mrmaple,项目名称:open_qon,代码行数:41,代码来源:cache_logging.py


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