Client & server¶
- ZEO.server(path=None, blob_dir=None, storage_conf=None, zeo_conf=None, port=0, threaded=True, **kw)¶
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.
- 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'>)¶
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)¶
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)¶
Storage API: return a sequence of HistoryEntry objects.
Server callback to update the info dictionary.
- invalidateTransaction(tid, oids)¶
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)¶
Return an IStorageTransactionInformation iterator.
- loadSerial(oid, serial)¶
Storage API: load a historical revision of an object.
Storage API: return a new object identifier.
- notify_connected(conn, info)¶
The connection is about to be established via conn.
info is a
dictproviding 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)¶
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)¶
Write data already committed in a separate database.
Server callback to pass a list of changed (oid, serial) pairs.
- store(oid, serial, data, version, txn)¶
Storage API: store data for an object.
- storeBlob(oid, serial, data, blobfilename, version, txn)¶
Storage API: store a blob object.
Storage API: return whether we support undo.
- tpc_abort(txn, timeout=None)¶
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=' ')¶
Storage API: begin a transaction.
- tpc_finish(txn, f=<function ClientStorage.<lambda>>)¶
Storage API: finish a transaction.
Storage API: vote on a transaction.
- undo(trans_id, txn)¶
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)¶
Storage API: return undo information.
- undoLog(first=0, last=-20, filter=None)¶
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.
Exceptions for ZEO.
- exception ZEO.Exceptions.AuthError¶
The client provided invalid authentication credentials.
- exception ZEO.Exceptions.ClientDisconnected¶
The database storage is disconnected from the storage.
- exception ZEO.Exceptions.ClientStorageError¶
An error occurred in the ZEO Client Storage.
- exception ZEO.Exceptions.ProtocolError¶
A client contacted a server with an incomparible protocol