def start(self): self.started = 1 self.path = tempfile.mktemp(suffix=".fs") self._storage = FileStorage(self.path) self.db = ZODB.DB(self._storage) self.do_updates() self.pid, self.exit = forker.start_zeo_server(self._storage, self.addr)
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)
def start(self): self.started =1 self.path = tempfile.mktemp(suffix=".fs") self._storage = FileStorage(self.path) self.db = ZODB.DB(self._storage) self.do_updates() self.pid, self.exit = forker.start_zeo_server(self._storage, self.addr)
def start(self): self.started =1 self.path = 'Data.fs' self._storage = FileStorage(self.path) self.db = ZODB.DB(self._storage) self.do_updates() self.pid, self.exit = forker.start_zeo_server(self._storage, self.addr)
def main(): # Yuck! Need to cleanup forker so that the API is consistent # across Unix and Windows, at least if that's possible. if os.name == "nt": zaddr, tport, pid = forker.start_zeo_server('MappingStorage', ()) def exitserver(): import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(tport) s.close() else: zaddr = '', random.randrange(20000, 30000) pid, exitobj = forker.start_zeo_server(MappingStorage(), zaddr) def exitserver(): exitobj.close() while 1: pid = start_child(zaddr) print("started", pid) os.waitpid(pid, 0) exitserver()
def setUp(self): logger.info("setUp() %s", self.id()) port = get_port() zconf = forker.ZEOConfig(('', port)) zport, adminaddr, pid, path = forker.start_zeo_server(self.getConfig(), zconf, port) self._pids = [pid] self._servers = [adminaddr] self._conf_path = path self._storage = ClientStorage(zport, '1', cache_size=20000000, min_disconnect_poll=0.5, wait=1, wait_timeout=60) self._storage.registerDB(DummyDB(), None)
def _new_storage(self): port = get_port(self) zconf = forker.ZEOConfig(("", port)) zport, adminaddr, pid, path = forker.start_zeo_server(self.getConfig(), zconf, port) self._pids.append(pid) self._servers.append(adminaddr) blob_cache_dir = tempfile.mkdtemp(dir=".") storage = ClientStorage( zport, "1", cache_size=20000000, min_disconnect_poll=0.5, wait=1, wait_timeout=60, blob_dir=blob_cache_dir ) storage.registerDB(DummyDB()) return storage
def startServer(self, create=1, index=0, read_only=0, ro_svr=0, keep=None): addr = self.addr[index] logging.info("startServer(create=%d, index=%d, read_only=%d) @ %s" % (create, index, read_only, addr)) path = "%s.%d" % (self.file, index) sconf = self.getConfig(path, create, read_only) zconf = self.getServerConfig(addr, ro_svr) if keep is None: keep = self.keep zeoport, adminaddr, pid, path = forker.start_zeo_server( sconf, zconf, addr[1], keep) self.conf_paths.append(path) self._pids.append(pid) self._servers.append(adminaddr)
def startServer(self, create=1, index=0, read_only=0, ro_svr=0, keep=None, path=None, **kw): addr = self.addr[index] logging.info("startServer(create=%d, index=%d, read_only=%d) @ %s" % (create, index, read_only, addr)) if path is None: path = "%s.%d" % (self.file, index) sconf = self.getConfig(path, create, read_only) zconf = self.getServerConfig(addr, ro_svr) if keep is None: keep = self.keep zeoport, stop = forker.start_zeo_server( sconf, zconf, addr[1], keep, **kw) self._servers.append(stop) if addr[1] == 0: self.addr[index] = zeoport
def setUp(self): logger.info("setUp() %s", self.id()) port = get_port() zconf = forker.ZEOConfig(('', port)) zport, adminaddr, pid, path = forker.start_zeo_server( self.getConfig(), zconf, port) self._pids = [pid] self._servers = [adminaddr] self._conf_path = path self._storage = ClientStorage(zport, '1', cache_size=20000000, min_disconnect_poll=0.5, wait=1, wait_timeout=60) self._storage.registerDB(DummyDB(), None)
def setUp(self): logger.info("setUp() %s", self.id()) port = get_port() zconf = forker.ZEOConfig(('', port)) zport, adminaddr, pid, path = forker.start_zeo_server( self.getConfig(), zconf, port) self._pids = [pid] self._servers = [adminaddr] self._conf_path = path if not self.blob_cache_dir: # This is the blob cache for ClientStorage self.blob_cache_dir = tempfile.mkdtemp() self._storage = ClientStorage(zport, '1', cache_size=20000000, min_disconnect_poll=0.5, wait=1, wait_timeout=60, blob_dir=self.blob_cache_dir, shared_blob_dir=self.shared_blob_dir) self._storage.registerDB(DummyDB())
def startServer(self, create=1, index=0, read_only=0, ro_svr=0, keep=None, path=None, **kw): addr = self.addr[index] logging.info("startServer(create=%d, index=%d, read_only=%d) @ %s" % (create, index, read_only, addr)) if path is None: path = "%s.%d" % (self.file, index) sconf = self.getConfig(path, create, read_only) zconf = self.getServerConfig(addr, ro_svr) if keep is None: keep = self.keep zeoport, stop = forker.start_zeo_server(sconf, zconf, addr[1], keep, **kw) self._servers.append(stop) if addr[1] == 0: self.addr[index] = zeoport
def setUp(self): StorageTestBase.StorageTestBase.setUp(self) logger.info("setUp() %s", self.id()) port = get_port(self) zconf = forker.ZEOConfig(("", port)) zport, adminaddr, pid, path = forker.start_zeo_server(self.getConfig(), zconf, port) self._pids = [pid] self._servers = [adminaddr] self._conf_path = path if not self.blob_cache_dir: # This is the blob cache for ClientStorage self.blob_cache_dir = tempfile.mkdtemp("blob_cache", dir=os.path.abspath(os.getcwd())) self._storage = ClientStorage( zport, "1", cache_size=20000000, min_disconnect_poll=0.5, wait=1, wait_timeout=60, blob_dir=self.blob_cache_dir, shared_blob_dir=self.shared_blob_dir, ) self._storage.registerDB(DummyDB())
def start_server(addr): storage = init_storage() pid, exit = forker.start_zeo_server(storage, addr) return pid, exit