ObjectStoreBackend

Trait ObjectStoreBackend 

Source
pub trait ObjectStoreBackend: Send + Sync {
    // Required methods
    fn put(&self, object: GitObject) -> Result<ObjectId>;
    fn get(&self, id: &ObjectId) -> Result<Option<GitObject>>;
    fn contains(&self, id: &ObjectId) -> Result<bool>;
    fn delete(&self, id: &ObjectId) -> Result<bool>;
    fn len(&self) -> Result<usize>;
    fn list_objects(&self) -> Result<Vec<ObjectId>>;

    // Provided methods
    fn is_empty(&self) -> Result<bool> { ... }
    fn batch_put(&self, objects: Vec<GitObject>) -> Result<Vec<ObjectId>> { ... }
    fn batch_get(&self, ids: &[ObjectId]) -> Result<Vec<Option<GitObject>>> { ... }
    fn flush(&self) -> Result<()> { ... }
    fn compact(&self) -> Result<()> { ... }
}
Expand description

Trait for object storage backends.

Implementations include in-memory, RocksDB, and hybrid storage.

Required Methods§

Source

fn put(&self, object: GitObject) -> Result<ObjectId>

Stores an object and returns its ID.

Source

fn get(&self, id: &ObjectId) -> Result<Option<GitObject>>

Retrieves an object by ID.

Source

fn contains(&self, id: &ObjectId) -> Result<bool>

Checks if an object exists.

Source

fn delete(&self, id: &ObjectId) -> Result<bool>

Deletes an object by ID.

Source

fn len(&self) -> Result<usize>

Returns the number of objects in the store.

Source

fn list_objects(&self) -> Result<Vec<ObjectId>>

Lists all object IDs.

Provided Methods§

Source

fn is_empty(&self) -> Result<bool>

Returns true if the store is empty.

Source

fn batch_put(&self, objects: Vec<GitObject>) -> Result<Vec<ObjectId>>

Batch put operation for improved throughput.

Source

fn batch_get(&self, ids: &[ObjectId]) -> Result<Vec<Option<GitObject>>>

Batch get operation.

Source

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

Flush any pending writes to durable storage.

Source

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

Compact the storage to reclaim space.

Implementations on Foreign Types§

Source§

impl<T: ObjectStoreBackend> ObjectStoreBackend for Arc<T>

Implementors§