pub struct CasStore { /* private fields */ }Expand description
Content-addressable chunk store.
Implementations§
Source§impl CasStore
impl CasStore
Sourcepub fn store_file(
&self,
rel_path: &str,
data: &[u8],
meta: &FileMeta,
) -> Result<CasStoreStats>
pub fn store_file( &self, rel_path: &str, data: &[u8], meta: &FileMeta, ) -> Result<CasStoreStats>
Store a file by chunking its data and writing unique chunks.
Sourcepub fn delta_store_file(
&self,
rel_path: &str,
data: &[u8],
meta: &FileMeta,
) -> Result<DeltaStoreStats>
pub fn delta_store_file( &self, rel_path: &str, data: &[u8], meta: &FileMeta, ) -> Result<DeltaStoreStats>
Store a file using chunk-level delta, writing only changed chunks.
Sourcepub fn delete_file(&self, rel_path: &str) -> Result<()>
pub fn delete_file(&self, rel_path: &str) -> Result<()>
Record a file deletion in the manifest.
Sourcepub fn rename_file(&self, from: &str, to: &str) -> Result<()>
pub fn rename_file(&self, from: &str, to: &str) -> Result<()>
Record a file rename in the manifest.
Sourcepub fn list_files(&self) -> Result<Vec<FileEntry>>
pub fn list_files(&self) -> Result<Vec<FileEntry>>
Replay manifest to get current file state.
Sourcepub fn compact(&self) -> Result<CompactStats>
pub fn compact(&self) -> Result<CompactStats>
Compact the manifest and remove orphaned chunks.
Sourcepub fn store_fxar_as_cas(&self, archive_name: &str, data: &[u8]) -> Result<()>
pub fn store_fxar_as_cas(&self, archive_name: &str, data: &[u8]) -> Result<()>
Store an FXAR archive as a CAS-chunked entity under a synthetic path.
Sourcepub fn read_fxar_from_cas(&self, archive_name: &str) -> Result<Vec<u8>>
pub fn read_fxar_from_cas(&self, archive_name: &str) -> Result<Vec<u8>>
Read an FXAR archive back from CAS, reconstructing it byte-identically.
Sourcepub fn has_fxar_in_cas(&self, archive_name: &str) -> Result<bool>
pub fn has_fxar_in_cas(&self, archive_name: &str) -> Result<bool>
Check whether an FXAR archive exists in this CAS store.
Sourcepub fn import_fxar<R: Read + Seek>(&self, reader: R) -> Result<CasStoreStats>
pub fn import_fxar<R: Read + Seek>(&self, reader: R) -> Result<CasStoreStats>
Import an FXAR v2 archive into this CAS store. Reads the archive, stores unique chunks, and creates manifest entries.
Sourcepub fn export_fxar<W: Write + Seek>(
&self,
writer: W,
compress: &str,
) -> Result<FxarExportStats>
pub fn export_fxar<W: Write + Seek>( &self, writer: W, compress: &str, ) -> Result<FxarExportStats>
Export this CAS store as an FXAR v2 archive.
Sourcepub fn store_files_batch(
&self,
files: &[(String, &[u8], &FileMeta)],
) -> Result<BatchStats>
pub fn store_files_batch( &self, files: &[(String, &[u8], &FileMeta)], ) -> Result<BatchStats>
Store multiple files in a single batch with amortized fsync.
Reduces NFS COMMIT RPCs from 2N (per-chunk sync + per-chunk dir sync) to ~3 for an N-file batch by deferring all fsyncs to two bulk phases: Phase 1: write all chunks (tmp -> rename, no fsync) Phase 2: fsync each unique chunk shard directory (typically 1-3) Phase 3: append all manifest entries + single fsync
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CasStore
impl RefUnwindSafe for CasStore
impl Send for CasStore
impl Sync for CasStore
impl Unpin for CasStore
impl UnsafeUnpin for CasStore
impl UnwindSafe for CasStore
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more