Struct IpldCache

Source
pub struct IpldCache<S, C, T> { /* private fields */ }
Expand description

Cache for ipld blocks.

Implementations§

Source§

impl<S, C, T> IpldCache<S, C, T>

Source

pub fn new(store: S, codec: C, size: usize) -> Self

Creates a new cache of size size.

Trait Implementations§

Source§

impl<S: Store + Send + Sync, C, T> Cache<C, T> for IpldCache<S, C, T>
where C: Decoder + Encoder + Clone + Send + Sync, T: Decode<<C as Decoder>::Codec> + Encode<<C as Encoder>::Codec> + Clone + Send + Sync,

Source§

fn create_batch(&self) -> CacheBatch<C, T>

Creates a typed batch.
Source§

fn create_batch_with_capacity(&self, capacity: usize) -> CacheBatch<C, T>

Creates a typed batch.
Source§

fn insert_batch<'life0, 'async_trait>( &'life0 self, batch: CacheBatch<C, T>, ) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inserts a batch into the store.
Source§

fn insert<'life0, 'async_trait>( &'life0 self, value: T, ) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Encodes and inserts a block.
Source§

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flushes all buffers.
Source§

fn unpin<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Unpins a block.
Source§

impl<S: ReadonlyStore + Send + Sync, C, T> ReadonlyCache<C, T> for IpldCache<S, C, T>
where C: Decoder + Clone + Send + Sync, T: Decode<<C as Decoder>::Codec> + Clone + Send + Sync,

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid, ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a decoded block.

Auto Trait Implementations§

§

impl<S, C, T> !Freeze for IpldCache<S, C, T>

§

impl<S, C, T> !RefUnwindSafe for IpldCache<S, C, T>

§

impl<S, C, T> Send for IpldCache<S, C, T>
where S: Send, C: Send, T: Send,

§

impl<S, C, T> Sync for IpldCache<S, C, T>
where S: Sync, C: Sync, T: Send,

§

impl<S, C, T> Unpin for IpldCache<S, C, T>
where S: Unpin, C: Unpin, T: Unpin,

§

impl<S, C, T> UnwindSafe for IpldCache<S, C, T>
where S: UnwindSafe, C: UnwindSafe, T: UnwindSafe,

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.