pub struct ObjectFetcher { /* private fields */ }
Expand description
Object fetcher for the Subspace DSN.
Implementations§
source§impl ObjectFetcher
impl ObjectFetcher
sourcepub fn new<PG>(
piece_getter: PG,
erasure_coding: ErasureCoding,
max_object_len: Option<usize>,
) -> Self
pub fn new<PG>( piece_getter: PG, erasure_coding: ErasureCoding, max_object_len: Option<usize>, ) -> Self
Create a new object fetcher with the given configuration.
max_object_len
is the amount of data bytes we’ll read for a single object before giving
up and returning an error, or None
for no limit (usize::MAX
).
sourcepub async fn fetch_object(
&self,
piece_index: PieceIndex,
piece_offset: u32,
) -> Result<Vec<u8>, Error>
pub async fn fetch_object( &self, piece_index: PieceIndex, piece_offset: u32, ) -> Result<Vec<u8>, Error>
Assemble the object in piece_index
at piece_offset
by fetching necessary pieces using
the piece getter and putting the object’s bytes together.
The caller should check the object’s hash to make sure the correct bytes are returned.
Auto Trait Implementations§
impl Freeze for ObjectFetcher
impl !RefUnwindSafe for ObjectFetcher
impl Send for ObjectFetcher
impl Sync for ObjectFetcher
impl Unpin for ObjectFetcher
impl !UnwindSafe for ObjectFetcher
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