pub struct ClusterPieceCache { /* private fields */ }Expand description
Cluster cache implementation
Implementations§
Source§impl ClusterPieceCache
impl ClusterPieceCache
Sourcepub fn new(
piece_cache_id: PieceCacheId,
max_num_elements: u32,
nats_client: NatsClient,
) -> ClusterPieceCache
pub fn new( piece_cache_id: PieceCacheId, max_num_elements: u32, nats_client: NatsClient, ) -> ClusterPieceCache
Create a new instance using information from previously received
ClusterCacheIdentifyBroadcast
Trait Implementations§
Source§impl Debug for ClusterPieceCache
impl Debug for ClusterPieceCache
Source§impl PieceCache for ClusterPieceCache
impl PieceCache for ClusterPieceCache
Source§fn id(&self) -> &PieceCacheId
fn id(&self) -> &PieceCacheId
ID of this cache
Source§fn max_num_elements(&self) -> u32
fn max_num_elements(&self) -> u32
Max number of elements in this cache
Source§fn contents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<(PieceCacheOffset, Option<PieceIndex>), FarmError>> + Unpin + Send + '_>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<(PieceCacheOffset, Option<PieceIndex>), FarmError>> + Unpin + Send + '_>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Contents of this piece cache. Read more
Source§fn write_piece<'life0, 'life1, 'async_trait>(
&'life0 self,
offset: PieceCacheOffset,
piece_index: PieceIndex,
piece: &'life1 Piece,
) -> Pin<Box<dyn Future<Output = Result<(), FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_piece<'life0, 'life1, 'async_trait>(
&'life0 self,
offset: PieceCacheOffset,
piece_index: PieceIndex,
piece: &'life1 Piece,
) -> Pin<Box<dyn Future<Output = Result<(), FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store piece in cache at specified offset, replacing existing piece if there is one. Read more
Source§fn read_piece_index<'life0, 'async_trait>(
&'life0 self,
offset: PieceCacheOffset,
) -> Pin<Box<dyn Future<Output = Result<Option<PieceIndex>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_piece_index<'life0, 'async_trait>(
&'life0 self,
offset: PieceCacheOffset,
) -> Pin<Box<dyn Future<Output = Result<Option<PieceIndex>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read piece index from cache at specified offset. Read more
Source§fn read_piece<'life0, 'async_trait>(
&'life0 self,
offset: PieceCacheOffset,
) -> Pin<Box<dyn Future<Output = Result<Option<(PieceIndex, Piece)>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_piece<'life0, 'async_trait>(
&'life0 self,
offset: PieceCacheOffset,
) -> Pin<Box<dyn Future<Output = Result<Option<(PieceIndex, Piece)>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read piece from cache at specified offset. Read more
Source§fn read_pieces<'life0, 'async_trait>(
&'life0 self,
offsets: Box<dyn Iterator<Item = PieceCacheOffset> + Send>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<(PieceCacheOffset, Option<(PieceIndex, Piece)>), FarmError>> + Send + Unpin + '_>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_pieces<'life0, 'async_trait>(
&'life0 self,
offsets: Box<dyn Iterator<Item = PieceCacheOffset> + Send>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<(PieceCacheOffset, Option<(PieceIndex, Piece)>), FarmError>> + Send + Unpin + '_>, FarmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read pieces from cache at specified offsets. Read more
Auto Trait Implementations§
impl Freeze for ClusterPieceCache
impl !RefUnwindSafe for ClusterPieceCache
impl Send for ClusterPieceCache
impl Sync for ClusterPieceCache
impl Unpin for ClusterPieceCache
impl !UnwindSafe for ClusterPieceCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more