Skip to main content

AnyStore

Enum AnyStore 

Source
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

Source§

fn get_blob(&self, hash: &ContentHash) -> Result<Option<Blob>>

Source§

fn put_blob(&self, blob: &Blob) -> Result<ContentHash>

Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

fn put_blob_with_hash( &self, blob: &Blob, hash: ContentHash, ) -> Result<ContentHash>

Source§

fn has_blob(&self, hash: &ContentHash) -> Result<bool>

Source§

fn get_tree(&self, hash: &ContentHash) -> Result<Option<Tree>>

Source§

fn put_tree(&self, tree: &Tree) -> Result<ContentHash>

Source§

fn has_tree(&self, hash: &ContentHash) -> Result<bool>

Source§

fn get_state(&self, id: &ChangeId) -> Result<Option<State>>

Source§

fn put_state(&self, state: &State) -> Result<()>

Source§

fn has_state(&self, id: &ChangeId) -> Result<bool>

Source§

fn list_states(&self) -> Result<Vec<ChangeId>>

Source§

fn get_action(&self, id: &ActionId) -> Result<Option<Action>>

Source§

fn put_action(&self, action: &mut Action) -> Result<ActionId>

Source§

fn list_actions(&self) -> Result<Vec<ActionId>>

Source§

fn list_blobs(&self) -> Result<Vec<ContentHash>>

Source§

fn list_trees(&self) -> Result<Vec<ContentHash>>

Source§

fn put_blob_bytes_with_hash( &self, data: &[u8], hash: ContentHash, ) -> Result<ContentHash>

Source§

fn put_tree_serialized( &self, data: &[u8], hash: ContentHash, ) -> Result<ContentHash>

Source§

fn put_state_serialized(&self, data: &[u8], id: ChangeId) -> Result<()>

Source§

fn put_action_serialized(&self, data: &[u8], id: ActionId) -> Result<()>

Source§

fn get_pack_object( &self, id: &PackObjectId, ) -> Result<Option<(ObjectType, Vec<u8>)>>

Source§

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 more
Source§

fn 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>>

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 more
Source§

fn pack_objects(&self, aggressive: bool) -> Result<(u64, u64)>

Source§

fn prune_loose_objects(&self) -> Result<(u64, u64)>

Source§

fn begin_snapshot_write_batch(&self) -> Result<()>

Source§

fn flush_snapshot_write_batch(&self) -> Result<()>

Source§

fn abort_snapshot_write_batch(&self)

Source§

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>>>

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 more
Source§

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 more
Source§

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>

Whether the store holds any state-visibility record for state. Read more
Source§

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 more
Source§

fn put_state_visibility_bytes_for_state( &self, state: &ChangeId, bytes: &[u8], ) -> Result<()>

Persist raw StateVisibilityBlob bytes for state. Read more
Source§

fn list_states_with_visibility(&self) -> Result<Vec<ChangeId>>

List every state with at least one state-visibility record. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more