Client & server

ZEO.server(path=None, blob_dir=None, storage_conf=None, zeo_conf=None, port=0, threaded=True, **kw)[source]

Convenience function to start a server for interactive exploration

This fuction starts a ZEO server, given a storage configuration or a file-storage path and blob directory. You can also supply a ZEO configuration string or a port. If neither a ZEO port or configuration is supplied, a port is chosen randomly.

The server address and a stop function are returned. The address can be passed to ZEO.ClientStorage.ClientStorage or ZEO.DB to create a client to the server. The stop function can be called without arguments to stop the server.



A file-storage path. This argument is ignored if a storage configuration is supplied.


A blob directory path. This argument is ignored if a storage configuration is supplied.


A storage configuration string. If none is supplied, then at least a file-storage path must be supplied and the storage configuration will be generated from the file-storage path and the blob directory.


A ZEO server configuration string.


If no ZEO configuration is supplied, the one will be computed from the port. If no port is supplied, one will be chosedn dynamically.

ZEO.client(*args, **kw)[source]

Shortcut for ZEO.ClientStorage.ClientStorage.

class ZEO.ClientStorage.ClientStorage(addr, storage='1', cache_size=20971520, name='', wait_timeout=None, disconnect_poll=None, read_only=0, read_only_fallback=0, blob_dir=None, shared_blob_dir=False, blob_cache_size=None, blob_cache_size_check=10, client_label=None, cache=None, ssl=None, ssl_server_hostname=None, client=None, var=None, min_disconnect_poll=1, max_disconnect_poll=None, wait=True, drop_cache_rather_verify=True, credentials=None, server_sync=False, username=None, password=None, realm=None, _client_factory=<class 'ZEO.asyncio.client.ClientThread'>)[source]

Bases: ConflictResolvingStorage

A storage class that is a network client to a remote storage.

This is a faithful implementation of the Storage API.

This class is thread-safe; transactions are serialized in tpc_begin().


Storage API: finalize the storage, releasing external resources.

copyTransactionsFrom(other, verbose=0)[source]

Copy transactions from another storage.

This is typically used for converting data from one storage to another. other must have an .iterator() method.


Storage API: return the storage name as a string.

The return value consists of two parts: the name as determined by the name and addr argments to the ClientStorage constructor, and the string ‘connected’ or ‘disconnected’ in parentheses indicating whether the storage is (currently) connected.


Storage API: an approximate size of the database, in bytes.

history(oid, size=1)[source]

Storage API: return a sequence of HistoryEntry objects.


Server callback to update the info dictionary.

invalidateTransaction(tid, oids)[source]

Server callback: Invalidate objects modified by tid.


Storage API: return whether we are in read-only mode.


Return whether the storage is currently connected to a server.


Storage API: return whether we are in read-only mode.

iterator(start=None, stop=None)[source]

Return an IStorageTransactionInformation iterator.

loadSerial(oid, serial)[source]

Storage API: load a historical revision of an object.


Storage API: return a new object identifier.

notify_connected(conn, info)[source]

The connection is about to be established via conn.

conn is an asyncio.client.ClientIO instance. We can use it already for asynchronous server calls but must not make synchronous calls or use the normal server call API (would lead to deadlock or ClientDisconnected).

info is a dict providing information about the server (and its associated storage).


Internal: notify that the server connection was terminated.

This is called by ConnectionManager when the connection is closed or when certain problems with the connection occur.

pack(t=None, referencesf=None, wait=1, days=0)[source]

Storage API: pack the storage.

Deviations from the Storage API: the referencesf argument is ignored; two additional optional arguments wait and days are provided:

wait – a flag indicating whether to wait for the pack to

complete; defaults to true.

days – a number of days to subtract from the pack time;

defaults to zero.


Storage API: get the next database record.

This is part of the conversion-support API.


Storage API: register a database for invalidation messages.

This is called by ZODB.DB (and by some tests).

The storage isn’t really ready to use until after this call.

restore(oid, serial, data, version, prev_txn, transaction)[source]

Write data already committed in a separate database.


Retrieve status dictionary from the server.

(The timeout keyword argument is for tests)

store(oid, serial, data, version, txn)[source]

Storage API: store data for an object.

storeBlob(oid, serial, data, blobfilename, version, txn)[source]

Storage API: store a blob object.


Storage API: return whether we support undo.

tpc_abort(txn, timeout=None)[source]

Storage API: abort a transaction.

(The timeout keyword argument is for tests to wait longer than they normally would.)

tpc_begin(txn, tid=None, status=' ')[source]

Storage API: begin a transaction.

tpc_finish(txn, f=<function ClientStorage.<lambda>>)[source]

Storage API: finish a transaction.


Storage API: vote on a transaction.

undo(trans_id, txn)[source]

Storage API: undo a transaction.

This is executed in a transactional context. It has no effect until the transaction is committed. It can be undone itself.

Zope uses this to implement undo unless it is not supported by a storage.

undoInfo(first=0, last=-20, specification=None)[source]

Storage API: return undo information.

undoLog(first=0, last=-20, filter=None)[source]

Storage API: return a sequence of TransactionDescription objects.

The filter argument should be None or left unspecified, since it is impossible to pass the filter function to the server to be executed there. If filter is not None, an empty sequence is returned.

ZEO.DB(*args, **kw)[source]

Shortcut for creating a ZODB.DB using a ZEO client().


Exceptions for ZEO.

exception ZEO.Exceptions.ClientDisconnected[source]

Bases: ClientStorageError, TransientError

The database storage is disconnected from the storage.

exception ZEO.Exceptions.ClientStorageError[source]

Bases: StorageError

An error occurred in the ZEO Client Storage.

exception ZEO.Exceptions.ProtocolError[source]

Bases: ClientStorageError

A client contacted a server with an incomparible protocol

exception ZEO.Exceptions.ServerException[source]

Bases: ClientStorageError

exception ZEO.Exceptions.UnrecognizedResult[source]

Bases: ClientStorageError

A server call returned an unrecognized result.