Skip to main content

ObjectStore

Trait ObjectStore 

Source
pub trait ObjectStore<ObjectID: FsVerityHashValue>: Send + Sync {
    // Required methods
    fn ensure_object_from_fd(&self, fd: OwnedFd, size: u64) -> Result<ObjectID>;
    fn write_semaphore(&self) -> Arc<Semaphore> ;
}
Expand description

An abstraction over content-addressed storage for file objects.

Both Repository and the C-compatible FlatDigestStore implement this trait so that read_filesystem can write file content to either layout without duplicating the scanning logic.

Required Methods§

Source

fn ensure_object_from_fd(&self, fd: OwnedFd, size: u64) -> Result<ObjectID>

Store fd as an object, returning its verity digest.

If an object with the same digest already exists, this is a no-op and the existing digest is returned.

Source

fn write_semaphore(&self) -> Arc<Semaphore>

Return a semaphore that gates concurrent object writes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<ObjectID: FsVerityHashValue> ObjectStore<ObjectID> for FlatDigestStore

Source§

impl<ObjectID: FsVerityHashValue> ObjectStore<ObjectID> for Repository<ObjectID>