daf.storage.chains

A chain of storage objects (first one wins).

This serves two purposes. First, it is only a StorageReader, so it protects the wrapped storage objects against accidental modification, even if they implement StorageWriter as well. Second, it allows delta-encoding, where data in early storage objects enhances or even overrides the data in later objects. For example, this is used in DafReader to present a unified view of the data in the derived cache and the base storage.

Classes:

StorageChain(chain, *[, name])

Low-level read-only access to a chain of storage objects (first one wins).

class daf.storage.chains.StorageChain(chain: Sequence[StorageReader], *, name: str = 'chain#')[source]

Bases: StorageReader

Low-level read-only access to a chain of storage objects (first one wins).

If the name ends with #, we append the object id to it to make it unique.

This is different from other storage implementations in that modifications to the wrapped storage objects are guaranteed to be immediately visible in the chain (in contrast to, for example, StorageView where this is not the case). The implementation of DafWriter relies on this fact.

Attributes:

chain

The unique chained StorageReader objects (first one wins).

chain: Tuple[StorageReader, ...]

The unique chained StorageReader objects (first one wins).