relstorage.interfaces – Interfaces for top-level RelStorage components

Interfaces for top-level RelStorage components.

These interfaces aren’t meant to be considered public, they exist to serve as documentation and for validation of RelStorage internals.

interface IMVCCDatabaseCoordinator[source]

A component that handles tracking multiple IMVCCDatabaseViewer components fulfilling the same role.

These components would be created by calling ZODB.interfaces.IMVCCStorage.new_instance() on the relstorage.interfaces.IRelStorage owned by the ZODB.interfaces.IDatabase object. There will be one for each ZODB.interfaces.IConnection object in a pool.

By tracking all existing components for a database within the same process, we can know what the maximum and minimum visible TIDs are within the process. When the minimum visible TID is incremented, we have an opportunity to take actions such as freeing data no longer needed (because it has been updated in a subsequent transaction and we now know the old states aren’t visible to any current connections.)


Across all tracked components, report the current highest visible tid. This is the most recent transaction that can be seen in this process.

(required? False)


Across all tracked components, report the current minimum highest visible tid. This is the oldest transaction potentially being viewed in this process.

(required? False)


Register the viewer to be tracked by this object.

A matching call to unregister() is expected.


Stop tracking the viewer.

interface IMVCCDatabaseViewer[source]

A component that has a consistent, point-in-time view of a database.

This is implemented using an RDBMS connection (session) with REPEATABLE READ or higher isolation level.

In the context of ZODB, this means that this view contains all the data for a particular transaction identifier (TID, also “revision” or “revid”; the contents of a particular persistent object’s _p_serial) and the transactions that come before it (lower TIDs), but not any newer (higher numbered) transactions that may exist.

The highest available TID is updated between transactions.

Viewers are associated with a IMVCCDatabaseCoordinator.


The identifier of the most recent transaction viewable to this component. A value of None means that we have no idea what transactions even exist.

(required? False)


alias of relstorage.interfaces._Field

class Factory(schema, description='', **kwargs)[source]

Bases: relstorage.interfaces._Field

class OID(description, required=False, **kwargs)[source]

Bases: relstorage.interfaces._Field

A ZODB object identifier, represented as a 64-bit integer.

class Object(schema, description='')[source]

Bases: relstorage.interfaces._Field

class TID(description, required=False, **kwargs)[source]

Bases: relstorage.interfaces._Field

A ZODB transaction identifier, represented as a 64-bit integer.

Traditionally, ZODB TIDs are created and derived using persistent.timestamp.TimeStamp, which is a reference to the current time.time value.

class Tuple(description, required=False, **kwargs)[source]

Bases: relstorage.interfaces._Field