pub struct BlockStoreRetry<S>where
S: BlockStore,{
pub store: S,
pub maximum_retries: u32,
pub attempt_window: Duration,
pub minimum_delay: Duration,
pub backoff: Option<Backoff>,
}Expand description
Implements retry and timeout logic for accessing blocks from a BlockStore.
Any BlockStore can be wrapped by BlockStoreRetry to get retry and
timeout logic for free. Each attempt to lookup a block is time limited by to
a specified window with optional Backoff, and at most maximum_retries
will be made to load the block.
Local BlockStore implementations won’t benefit a lot from this, but network implementations such as [IpfsStore] can be made more reliable with a modest retry policy (and timeouts will help make sure we don’t hang indefinitely waiting for an implementation like Kubo to get its act together).
Fields§
§store: SA BlockStore implementation that the BlockStoreRetry proxies reads to in order to implement retry behavior
maximum_retries: u32The maximum number of additional attempts to make if a read to the wrapped store should fail
attempt_window: DurationThe maximum time that a read is allowed to take before it is considered failed
minimum_delay: DurationThe minimum time between attempts
backoff: Option<Backoff>If a Backoff is configured, the attempt window will grow with each attempt based on the configuration
Trait Implementations§
Source§impl<S> BlockStore for BlockStoreRetry<S>where
S: BlockStore,
impl<S> BlockStore for BlockStoreRetry<S>where
S: BlockStore,
Source§fn put_block<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
cid: &'life1 Cid,
block: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_block<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
cid: &'life1 Cid,
block: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn put_links<'life0, 'life1, 'life2, 'async_trait, C>(
&'life0 mut self,
cid: &'life1 Cid,
block: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
Ipld: References<C>,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_links<'life0, 'life1, 'life2, 'async_trait, C>(
&'life0 mut self,
cid: &'life1 Cid,
block: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
Ipld: References<C>,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn put<'life0, 'async_trait, C, T>(
&'life0 mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
T: Encode<C> + ConditionalSend + 'async_trait,
Ipld: References<C>,
Self: Send + 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait, C, T>(
&'life0 mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
T: Encode<C> + ConditionalSend + 'async_trait,
Ipld: References<C>,
Self: Send + 'async_trait,
'life0: 'async_trait,
Source§fn get<'life0, 'life1, 'async_trait, C, T>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
fn get<'life0, 'life1, 'async_trait, C, T>( &'life0 self, cid: &'life1 Cid, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
Source§fn save<'life0, 'async_trait, C, T>(
&'life0 mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
T: Serialize + ConditionalSend + 'async_trait,
Ipld: Encode<C> + References<C>,
Self: Send + 'async_trait,
'life0: 'async_trait,
fn save<'life0, 'async_trait, C, T>(
&'life0 mut self,
data: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
T: Serialize + ConditionalSend + 'async_trait,
Ipld: Encode<C> + References<C>,
Self: Send + 'async_trait,
'life0: 'async_trait,
Source§fn load<'life0, 'life1, 'async_trait, C, T>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
T: DeserializeOwned + ConditionalSend + 'async_trait,
u64: From<C>,
Ipld: Decode<C>,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait, C, T>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>where
C: Codec + Default + 'async_trait,
T: DeserializeOwned + ConditionalSend + 'async_trait,
u64: From<C>,
Ipld: Decode<C>,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn require_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn require_block<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<S> Clone for BlockStoreRetry<S>where
S: BlockStore + Clone,
impl<S> Clone for BlockStoreRetry<S>where
S: BlockStore + Clone,
Source§fn clone(&self) -> BlockStoreRetry<S>
fn clone(&self) -> BlockStoreRetry<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more