pub struct ObjectFetcher<PG>{ /* private fields */ }
Expand description
Object fetcher for the Subspace DSN.
Implementations§
Source§impl<PG> ObjectFetcher<PG>
impl<PG> ObjectFetcher<PG>
Sourcepub fn new(
piece_getter: Arc<PG>,
erasure_coding: ErasureCoding,
max_object_len: usize,
) -> Self
pub fn new( piece_getter: Arc<PG>, erasure_coding: ErasureCoding, max_object_len: 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. In this implementation, it is limited to
MAX_SUPPORTED_OBJECT_LENGTH
, which is much larger than the largest block on any domain
(as of December 2024).
Sourcepub async fn fetch_objects(
&self,
mappings: GlobalObjectMapping,
) -> Result<Vec<Vec<u8>>, Error>
pub async fn fetch_objects( &self, mappings: GlobalObjectMapping, ) -> Result<Vec<Vec<u8>>, Error>
Assemble the objects in mapping
by fetching necessary pieces using the piece getter, and
putting the objects’ bytes together.
Checks the objects’ hashes to make sure the correct bytes are returned.
Auto Trait Implementations§
impl<PG> Freeze for ObjectFetcher<PG>
impl<PG> RefUnwindSafe for ObjectFetcher<PG>where
PG: RefUnwindSafe,
impl<PG> Send for ObjectFetcher<PG>
impl<PG> Sync for ObjectFetcher<PG>
impl<PG> Unpin for ObjectFetcher<PG>
impl<PG> UnwindSafe for ObjectFetcher<PG>where
PG: RefUnwindSafe,
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