HybridStorage

Struct HybridStorage 

Source
pub struct HybridStorage<C> { /* private fields */ }
Expand description

Hybrid storage combining hot in-memory and cold persistent storage.

Implementations§

Source§

impl<C> HybridStorage<C>
where C: ObjectStoreBackend + Send + Sync + 'static,

Source

pub fn new(cold: C, config: HybridConfig) -> Self

Creates a new hybrid storage.

Source

pub fn with_defaults(cold: C) -> Self

Creates with default configuration.

Source

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

Gets an object, checking hot storage first.

Source

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

Puts an object (always goes to hot first, then cold).

Source

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

Checks if an object exists.

Source

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

Deletes an object from all tiers.

Source

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

Returns the total number of objects.

Source

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

Returns true if empty.

Source

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

Lists all object IDs.

Source

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

Flushes hot storage to cold.

Source

pub fn stats(&self) -> HybridStatsSnapshot

Returns storage statistics.

Trait Implementations§

Source§

impl<C> ObjectStoreBackend for HybridStorage<C>
where C: ObjectStoreBackend + Send + Sync + 'static,

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.
Source§

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

Flush any pending writes to durable storage.
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 compact(&self) -> Result<()>

Compact the storage to reclaim space.

Auto Trait Implementations§

§

impl<C> !Freeze for HybridStorage<C>

§

impl<C> !RefUnwindSafe for HybridStorage<C>

§

impl<C> Send for HybridStorage<C>
where C: Sync + Send,

§

impl<C> Sync for HybridStorage<C>
where C: Sync + Send,

§

impl<C> Unpin for HybridStorage<C>

§

impl<C> !UnwindSafe for HybridStorage<C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.