pub struct BlobStore { /* private fields */ }Expand description
A content-addressed blob store over a pluggable object backend.
Implementations§
Source§impl BlobStore
impl BlobStore
Sourcepub fn new(data_dir: &str) -> Result<Self>
pub fn new(data_dir: &str) -> Result<Self>
Open the blob store on the local filesystem at <data_dir>/blobs, or at
TAEL_BLOB_DIR when set (e.g. a separate fast mount). This is the
default, single-binary path.
Sourcepub fn with_backend(backend: Arc<dyn ObjectBackend>) -> Result<Self>
pub fn with_backend(backend: Arc<dyn ObjectBackend>) -> Result<Self>
Open the blob store on an arbitrary object backend (e.g. GCS). The path layout is identical, so the backend is a transparent swap.
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.
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.)
Single-owner contract: on a shared object store this must run on
exactly one node with a live set spanning all shards, or it will
delete blobs other shards still reference. lib.rs enforces this by
disabling per-node GC when the blob store is shared (GCS) unless this
node is the designated coordinator.
Auto Trait Implementations§
impl !RefUnwindSafe for BlobStore
impl !UnwindSafe for BlobStore
impl Freeze for BlobStore
impl Send for BlobStore
impl Sync for BlobStore
impl Unpin for BlobStore
impl UnsafeUnpin 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
impl<T> Fruit 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