salvus.flow.acta.store.local
salvus.flow.acta.store.local salvus flow acta store local Local filesystem content storage.
Objects use objects/<digest[:2]>/<digest[2:4]>/<digest>; bindings use
bindings/<key[:2]>/<key[2:4]>/<key>. Writes use atomic replacement.
Object files are read-only and are not rehashed on fetch.
Classes
ContentStore
ContentStoreclass ContentStore(salvus.flow.acta.store.base.ContentStoreBase):
def __init__(self, root: pathlib.Path) -> None: ...Local-filesystem, content-addressed blob store.
rootpathlib.Path — Directory that owns the store. Created on first use, along with itsobjectsandbindingssubdirectories.
root pathlib.Path
root pathlib.PathReturn the store’s root directory.
binding_path()
binding_path()def binding_path(self, key: str) -> pathlib.Path: ...Return the on-disk path for key, whether or not it exists.
keystr — A binding key.
delete()
delete()def delete(self, digest: str) -> None: ...Remove the object stored under digest.
digeststr — A content digest.
delete_binding()
delete_binding()def delete_binding(self, key: str) -> None: ...Remove the binding for key, if there is one.
Leave the target object unchanged.
keystr — The key to unbind, 64 lowercase hex characters.
exists()
exists()def exists(self, digest: str) -> bool: ...Return True if an object with digest is present.
digeststr — A content digest.
fetch_bytes()
fetch_bytes()def fetch_bytes(self, digest: str) -> bytes: ...Return the raw bytes stored under digest.
digeststr — A content digest.
digest first if this backend’s verify_on_fetch is True.fetch_file()
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.
digeststr — A content digest.
0o444 for a temp copy.get_binding()
get_binding()def get_binding(self, key: str) -> str | None: ...Return the digest bound to key, or None if unbound.
keystr — The key to look up, 64 lowercase hex characters.
iter_bindings()
iter_bindings()def iter_bindings(self) -> Iterator[tuple[str, str]]: ...Yield every (key, digest) pair under bindings.
Skip entries with invalid keys or digests.
iter_digests()
iter_digests()def iter_digests(self) -> Iterator[str]: ...Yield every digest under the two-character shard directories.
Skip names that are not valid digests.
modified_at()
modified_at()def modified_at(self, digest: str) -> datetime.datetime | None: ...Return the object’s mtime, or None if it is not there.
digeststr — A content digest.
object_path()
object_path()def object_path(self, digest: str) -> pathlib.Path: ...Return the on-disk path for digest, whether or not it exists.
Use fetch_file for backend-independent access.
digeststr — A content digest.
put_binding()
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.
keystr — The key to bind, 64 lowercase hex characters.digeststr — The content digest to bind it to.
put_bytes()
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.
databytes — The bytes to store.
data.put_file()
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.
pathpathlib.Path — Path to the file whose bytes should be stored.