pub enum AnyStore {
Fs(FsStore),
}Expand description
Static-dispatch enum over the concrete object stores Heddle ships.
This is the default S for Repository so the store backend
can be chosen at runtime (from [storage.s3] config in
Repository::build_store) while remaining a compile-time-monomorphized
type — no vtable. Each ObjectStore method match-dispatches to the
inner variant, so the compiler inlines through the enum to the concrete
backend’s implementation (including its overridden default methods).
Sealed by construction: only the variants enumerated here are valid
stores. Heddle is the sole implementer (heddle#259 / #283) — AnyStore
is not a public extension point.
Variants§
Trait Implementations§
Source§impl ObjectStore for AnyStore
impl ObjectStore for AnyStore
fn get_blob(&self, hash: &ContentHash) -> Result<Option<Blob>>
fn put_blob(&self, blob: &Blob) -> Result<ContentHash>
Source§fn get_blob_bytes(&self, hash: &ContentHash) -> Result<Option<Bytes>>
fn get_blob_bytes(&self, hash: &ContentHash) -> Result<Option<Bytes>>
Zero-copy variant of
get_blob. Returns a bytes::Bytes
view of the blob’s content, which for FsStore reads is a
slice into the pack file’s mmap when the entry is non-delta
and uncompressed — no allocation, no memcpy. Read moreSource§fn blob_size(&self, hash: &ContentHash) -> Result<Option<u64>>
fn blob_size(&self, hash: &ContentHash) -> Result<Option<u64>>
Return the uncompressed byte length of the blob identified by
hash, or Ok(None) when the blob is not in the store. Read moreSource§fn loose_blob_path(&self, hash: &ContentHash) -> Option<PathBuf>
fn loose_blob_path(&self, hash: &ContentHash) -> Option<PathBuf>
Filesystem path of the loose blob whose on-disk bytes are
byte-identical to the blob’s uncompressed content, suitable
for
hard_link/clonefile materialization without going
through get_blob. Read moreSource§fn promote_to_loose_uncompressed(&self, hash: &ContentHash) -> Result<bool>
fn promote_to_loose_uncompressed(&self, hash: &ContentHash) -> Result<bool>
Ensure the blob identified by
hash is materialized as an
uncompressed loose file at the canonical loose path so that
loose_blob_path returns Some(path) on a subsequent call. Read moreSource§fn clear_recent_caches(&self)
fn clear_recent_caches(&self)
Drop any in-memory caches of decompressed blobs / trees /
states. The next access to any object pays full I/O +
decompression cost. No-op for stores that don’t cache
(
InMemoryStore is already the source of truth). Read morefn put_blob_with_hash( &self, blob: &Blob, hash: ContentHash, ) -> Result<ContentHash>
fn has_blob(&self, hash: &ContentHash) -> Result<bool>
fn get_tree(&self, hash: &ContentHash) -> Result<Option<Tree>>
fn put_tree(&self, tree: &Tree) -> Result<ContentHash>
fn has_tree(&self, hash: &ContentHash) -> Result<bool>
fn get_state(&self, id: &ChangeId) -> Result<Option<State>>
fn put_state(&self, state: &State) -> Result<()>
fn has_state(&self, id: &ChangeId) -> Result<bool>
fn list_states(&self) -> Result<Vec<ChangeId>>
fn get_action(&self, id: &ActionId) -> Result<Option<Action>>
fn put_action(&self, action: &mut Action) -> Result<ActionId>
fn list_actions(&self) -> Result<Vec<ActionId>>
fn list_blobs(&self) -> Result<Vec<ContentHash>>
fn list_trees(&self) -> Result<Vec<ContentHash>>
fn put_blob_bytes_with_hash( &self, data: &[u8], hash: ContentHash, ) -> Result<ContentHash>
fn put_tree_serialized( &self, data: &[u8], hash: ContentHash, ) -> Result<ContentHash>
fn put_state_serialized(&self, data: &[u8], id: ChangeId) -> Result<()>
fn put_action_serialized(&self, data: &[u8], id: ActionId) -> Result<()>
fn get_pack_object( &self, id: &PackObjectId, ) -> Result<Option<(ObjectType, Vec<u8>)>>
Source§fn put_blobs_packed(&self, blobs: Vec<(ContentHash, Vec<u8>)>) -> Result<()>
fn put_blobs_packed(&self, blobs: Vec<(ContentHash, Vec<u8>)>) -> Result<()>
Bulk-write a batch of blobs as a single durable unit. The default
implementation falls back to per-blob writes; backends that
support packfiles (i.e.
FsStore) override this to install one
packfile + index — two fsyncs total instead of N. Used by the
snapshot hot path so writing 1000 small files takes ~one fsync,
not 1000. Read morefn install_pack( &self, pack_data: &[u8], index_data: &[u8], ) -> Result<Vec<PackObjectId>>
Source§fn install_pack_streaming(
&self,
pack_path: &Path,
index_path: &Path,
) -> Result<Vec<PackObjectId>>
fn install_pack_streaming( &self, pack_path: &Path, index_path: &Path, ) -> Result<Vec<PackObjectId>>
Install a pack and its index from on-disk files
(typically produced by
StreamingPackBuilder). The default
impl reads both files fully and delegates to install_pack,
so any backend that doesn’t override this still works (at the
cost of giving back the bounded-memory promise). Real fs-
backed stores override this to rename(2) both files into the
pack directory without ever loading them. Read morefn pack_objects(&self, aggressive: bool) -> Result<(u64, u64)>
fn prune_loose_objects(&self) -> Result<(u64, u64)>
fn begin_snapshot_write_batch(&self) -> Result<()>
fn flush_snapshot_write_batch(&self) -> Result<()>
fn abort_snapshot_write_batch(&self)
Source§fn has_redactions_for_blob(&self, blob: &ContentHash) -> Result<bool>
fn has_redactions_for_blob(&self, blob: &ContentHash) -> Result<bool>
Whether the store holds any redaction record for the given blob. Read more
Source§fn get_redactions_bytes_for_blob(
&self,
blob: &ContentHash,
) -> Result<Option<Vec<u8>>>
fn get_redactions_bytes_for_blob( &self, blob: &ContentHash, ) -> Result<Option<Vec<u8>>>
Return the raw rmp-encoded
RedactionsBlob bytes for the given
blob, or Ok(None) if no redaction record exists. The bytes
are byte-identical to what was written by put_redactions_bytes_for_blob
(or by Repository::put_redaction); this is the wire-transfer
payload, not a re-serialized view. Read moreSource§fn put_redactions_bytes_for_blob(
&self,
blob: &ContentHash,
bytes: &[u8],
) -> Result<()>
fn put_redactions_bytes_for_blob( &self, blob: &ContentHash, bytes: &[u8], ) -> Result<()>
Persist the rmp-encoded
RedactionsBlob bytes for the given
blob. Receiver-side replay calls this after signature
verification so the bytes land in the same sidecar that the
sender’s Repository::put_redaction writes to. Read moreSource§fn list_blobs_with_redactions(&self) -> Result<Vec<ContentHash>>
fn list_blobs_with_redactions(&self) -> Result<Vec<ContentHash>>
List every blob that has at least one redaction record. Used by
the GC pin guard and by sync to enumerate redactions for the
state closure. Order is unspecified; callers that need stable
ordering should sort. Read more
Source§fn has_state_visibility_for_state(&self, state: &ChangeId) -> Result<bool>
fn has_state_visibility_for_state(&self, state: &ChangeId) -> Result<bool>
Whether the store holds any state-visibility record for
state. Read moreSource§fn get_state_visibility_bytes_for_state(
&self,
state: &ChangeId,
) -> Result<Option<Vec<u8>>>
fn get_state_visibility_bytes_for_state( &self, state: &ChangeId, ) -> Result<Option<Vec<u8>>>
Return the raw rmp-encoded
StateVisibilityBlob bytes for state,
or Ok(None) if no sidecar exists. The bytes are the wire-transfer
payload for state visibility. Read moreAuto Trait Implementations§
impl !Freeze for AnyStore
impl RefUnwindSafe for AnyStore
impl Send for AnyStore
impl Sync for AnyStore
impl Unpin for AnyStore
impl UnsafeUnpin for AnyStore
impl UnwindSafe for AnyStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more