pub struct DiskPieceCache { /* private fields */ }Expand description
Dedicated piece cache stored on one disk, is used both to accelerate DSN queries and to plot faster.
Implementation is backed by a file on disk.
Implementations§
Source§impl DiskPieceCache
impl DiskPieceCache
Sourcepub fn open(
directory: &Path,
capacity: NonZeroU32,
id: Option<PieceCacheId>,
registry: Option<&mut Registry>,
) -> Result<Self, DiskPieceCacheError>
pub fn open( directory: &Path, capacity: NonZeroU32, id: Option<PieceCacheId>, registry: Option<&mut Registry>, ) -> Result<Self, DiskPieceCacheError>
Open cache, capacity is measured in elements of DiskPieceCache::element_size() size
Sourcepub const fn element_size() -> u32
pub const fn element_size() -> u32
Size of a single piece cache element
Trait Implementations§
Source§impl Clone for DiskPieceCache
impl Clone for DiskPieceCache
Source§fn clone(&self) -> DiskPieceCache
fn clone(&self) -> DiskPieceCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiskPieceCache
impl Debug for DiskPieceCache
Source§impl PieceCache for DiskPieceCache
impl PieceCache for DiskPieceCache
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 DiskPieceCache
impl !RefUnwindSafe for DiskPieceCache
impl Send for DiskPieceCache
impl Sync for DiskPieceCache
impl Unpin for DiskPieceCache
impl !UnwindSafe for DiskPieceCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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