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 !RefUnwindSafe for ClusterPieceCache
impl !UnwindSafe for ClusterPieceCache
impl Forget for ClusterPieceCache
impl Freeze for ClusterPieceCachewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<Inner> is !null: Freeze,
PhantomData<Inner>: Freeze,
impl Move for ClusterPieceCache
impl Send for ClusterPieceCache
impl Sync for ClusterPieceCache
impl Unpin for ClusterPieceCachewhere
*const u8 is !null: Unpin,
*const ArcInner<Inner> is !null: Unpin,
Arc<Shared<Option<ServerInfo>>>: Unpin,
Arc<Shared<State>>: Unpin,
Arc<Chan<Command, Semaphore>>: Unpin,
Box<dyn Future<Output = Result<OwnedPermit<Command>, PollSendError<Command>>> + Send>: Unpin,
Arc<AtomicU64>: Unpin,
Arc<str>: Unpin,
Arc<Atomic<usize>>: Unpin,
Arc<Statistics>: Unpin,
impl UnsafeUnpin for ClusterPieceCachewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<Inner> is !null: UnsafeUnpin,
PhantomData<Inner>: UnsafeUnpin,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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