pub struct BlobStore { /* private fields */ }Expand description
A local-filesystem content-addressed blob store. The same path layout is a valid object-store key prefix, so a future S3/R2 backend is a swap behind this type (design Phase 9).
Implementations§
Source§impl BlobStore
impl BlobStore
Sourcepub fn new(data_dir: &str) -> Result<Self>
pub fn new(data_dir: &str) -> Result<Self>
Open (creating if needed) the blob store rooted at <data_dir>/blobs.
Sourcepub fn put(&self, content: &[u8]) -> Result<String>
pub fn put(&self, content: &[u8]) -> Result<String>
Hash content, write it snap-compressed if not already present, and
return the hex sha256. Idempotent: re-putting identical content is a
cheap no-op (the dedup property).
Sourcepub fn get(&self, hash: &str) -> Result<Option<Vec<u8>>>
pub fn get(&self, hash: &str) -> Result<Option<Vec<u8>>>
Fetch and decompress a blob by hex sha256. Ok(None) if it doesn’t
exist (e.g. GC’d under retention).
Sourcepub fn list_hashes(&self) -> Result<Vec<String>>
pub fn list_hashes(&self) -> Result<Vec<String>>
List every stored blob hash (walks the shard tree).
Sourcepub fn remove(&self, hash: &str) -> Result<()>
pub fn remove(&self, hash: &str) -> Result<()>
Delete a blob by hash. Missing blobs are a no-op.
Sourcepub fn gc(&self, live: &HashSet<String>) -> Result<usize>
pub fn gc(&self, live: &HashSet<String>) -> Result<usize>
Mark-and-sweep GC: delete every blob whose hash is not in live.
Returns the number of blobs removed. (Blobs are written before their
referencing row, so an orphan = a row that never landed, or a row that
retention has since dropped — both safe to collect.)
Auto Trait Implementations§
impl Freeze for BlobStore
impl RefUnwindSafe for BlobStore
impl Send for BlobStore
impl Sync for BlobStore
impl Unpin for BlobStore
impl UnsafeUnpin for BlobStore
impl UnwindSafe for BlobStore
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request