Mondaic

salvus.flow.acta.store.tiered

salvus.flow.acta.store.tiered salvus flow acta store tiered

Content stores ordered from nearest to farthest.

Reads copy verified objects into nearer tiers. Writes target the nearest tier; explicit promotion copies objects outward. Read failures skip a tier, except digest mismatches; write failures propagate.

Classes

TieredContentStore

class TieredContentStore(salvus.flow.acta.store.base.ContentStoreBase):
    def __init__(self, tiers: Sequence[ContentStoreBase]) -> None: ...

Several content stores read as one, nearest first.

Parameters
  • tiers Sequence[ContentStoreBase] — The stores to stack, nearest first. At least one.
Attributes
tiers tuple[ContentStoreBase, ...]

Return the stacked stores, nearest first.

Methods
delete()
def delete(self, digest: str) -> None: ...

Remove the object stored under digest.

Parameters
  • digest str — A content digest.
Returns None
delete_binding()
def delete_binding(self, key: str) -> None: ...

Remove the binding for key, if there is one.

Leave the target object unchanged.

Parameters
  • key str — The key to unbind, 64 lowercase hex characters.
Returns None
exists()
def exists(self, digest: str) -> bool: ...

Return True if an object with digest is present.

Parameters
  • digest str — A content digest.
Returns bool
fetch_bytes()
def fetch_bytes(self, digest: str) -> bytes: ...

Return the raw bytes stored under digest.

Parameters
  • digest str — A content digest.
Returns bytes — The object’s bytes, re-verified against digest first if this backend’s verify_on_fetch is True.
fetch_file()
def fetch_file(self, digest: str) -> pathlib.Path: ...

Return a read-only local path to the object under digest.

Reuse a local file when verify_on_fetch is false. Otherwise fetch bytes under the verification policy and write a temporary file. Missing objects and verification errors propagate.

Parameters
  • digest str — A content digest.
Returns pathlib.Path — A path to the object’s bytes, mode 0o444 for a temp copy.
get_binding()
def get_binding(self, key: str) -> str | None: ...

Return the digest bound to key, or None if unbound.

Parameters
  • key str — The key to look up, 64 lowercase hex characters.
Returns str | None
iter_bindings()
def iter_bindings(self) -> Iterator[tuple[str, str]]: ...

Yield every binding any reachable tier holds, deduplicated.

Prefer the nearest tier for duplicate keys. Skip tiers that cannot be listed.

Returns Iterator[tuple[str, str]]
iter_digests()
def iter_digests(self) -> Iterator[str]: ...

Yield every digest any reachable tier holds, deduplicated.

Returns Iterator[str]
modified_at()
def modified_at(self, digest: str) -> datetime.datetime | None: ...

Return the nearest tier’s write time for digest.

Parameters
  • digest str — A content digest.
Returns datetime.datetime | None
promote()
def promote(self, digests: Iterable[str]) -> None: ...

Copy digests outward, to every tier that lacks them.

Copy descriptor payloads before descriptors. Write failures propagate.

Parameters
  • digests Iterable[str] — The refs to push outward.
Returns None
promote_binding()
def promote_binding(self, key: str, digest: str) -> None: ...

Bind key outward, in every tier beyond the nearest.

Write failures propagate.

Parameters
  • key str — The key to bind, 64 lowercase hex characters.
  • digest str — The digest to bind it to.
Returns None
put_binding()
def put_binding(self, key: str, digest: str) -> None: ...

Bind key to digest, replacing any existing binding.

Validate the key and digest format; the target object need not exist.

Parameters
  • key str — The key to bind, 64 lowercase hex characters.
  • digest str — The content digest to bind it to.
Returns None
put_bytes()
def put_bytes(self, data: bytes) -> str: ...

Store data and return its digest.

Verify existing objects and reuse them. Raise DigestMismatchError if stored bytes differ from their digest.

Parameters
  • data bytes — The bytes to store.
Returns str — The content digest of data.
put_file()
def put_file(self, path: pathlib.Path) -> str: ...

Store the bytes of an existing file and return its digest.

Hash and stage the same chunks, then write through _write_file. Verify and reuse an existing object.

Parameters
  • path pathlib.Path — Path to the file whose bytes should be stored.
Returns str — The content digest of the file’s contents.