pub trait Storage<S: StoreParams>:
Send
+ Sync
+ 'static {
type Subscription: Stream<Item = StorageEvent> + Send + Unpin;
// Required methods
fn contains(&self, cid: &Cid) -> Result<bool>;
fn get(&self, cid: &Cid) -> Result<Option<Vec<u8>>>;
fn insert(&self, block: &Block<S>) -> Result<()>;
fn alias<'life0, 'life1, 'async_trait, T>(
&'life0 self,
alias: T,
cid: Option<&'life1 Cid>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where T: 'async_trait + AsRef<[u8]> + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn resolve<T: AsRef<[u8]> + Send + Sync>(
&self,
alias: T,
) -> Result<Option<Cid>>;
fn pinned<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Option<bool>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn subscribe(&self) -> Self::Subscription;
}
Required Associated Types§
type Subscription: Stream<Item = StorageEvent> + Send + Unpin
Required Methods§
fn contains(&self, cid: &Cid) -> Result<bool>
fn get(&self, cid: &Cid) -> Result<Option<Vec<u8>>>
fn insert(&self, block: &Block<S>) -> Result<()>
fn alias<'life0, 'life1, 'async_trait, T>( &'life0 self, alias: T, cid: Option<&'life1 Cid>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn resolve<T: AsRef<[u8]> + Send + Sync>(&self, alias: T) -> Result<Option<Cid>>
fn pinned<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Option<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe(&self) -> Self::Subscription
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.