Exemplo n.º 1
0
        def zlibfactory():
            # Wraps uri in :class:`zc.slibstorage.ZlibStorage` and returns a
            # :class:`ZODB.DB`

            # Delay setting the client name until the very end so whatever is going to
            # set environment variables will have done so.
            if 'client' not in storage_kw:
                name = os.environ.get("DATASERVER_ZEO_CLIENT_NAME")
                if name:  # pragma: no cover This isn't documented.
                    # storage name is automatically part of it
                    storage_kw['client'] = name
            # ClientCache docs say 200MB is good
            storage_kw.setdefault('cache_size', 200 * 1024 * 1024)

            # Client storage is very picky: a Unix path must be bytes, not
            # unicode
            client = ClientStorage(*args, **storage_kw)
            if 'demostorage' in orig_kw:  # pragma: no cover
                client = DemoStorage(base=client)

            zlib = ZlibStorage(client)
            return DB(zlib, **dbkw)
Exemplo n.º 2
0
 def zlibfactory():
     db = _factory()
     db.storage = ZlibStorage(db.storage)
     return db
Exemplo n.º 3
0
 def _wrap_storage(self, storage):
     return self._closing(ZlibStorage(storage))
Exemplo n.º 4
0
 def _create_dest_storage(self):
     return ZlibStorage(super(ZlibWrappedZODBConvertTests, self)._create_dest_storage())