pub struct FileTerm {
pub byte_range: FileRange,
pub xorb_chunk_range: ChunkRange,
pub xorb_block_start_index: usize,
pub offset_into_first_range: u64,
pub xorb_block: Arc<XorbBlock>,
pub url_info: Arc<TermBlockRetrievalURLs>,
}Expand description
A single term in a file reconstruction, representing a contiguous byte range in the output file that maps to a chunk range within a xorb block.
Fields§
§byte_range: FileRange§xorb_chunk_range: ChunkRange§xorb_block_start_index: usize§offset_into_first_range: u64§xorb_block: Arc<XorbBlock>§url_info: Arc<TermBlockRetrievalURLs>Implementations§
Source§impl FileTerm
impl FileTerm
pub fn extract_bytes(&self, xorb_block_data: &XorbBlockData) -> Bytes
Sourcepub async fn get_data_task(
&self,
client: Arc<dyn Client>,
progress_updater: Option<Arc<ItemProgressUpdater>>,
chunk_cache: Option<Arc<dyn ChunkCache>>,
) -> Result<Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>>
pub async fn get_data_task( &self, client: Arc<dyn Client>, progress_updater: Option<Arc<ItemProgressUpdater>>, chunk_cache: Option<Arc<dyn ChunkCache>>, ) -> Result<Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>>
Get a future that will retrieve and extract the data bytes for this file term.
If the xorb data is already cached, returns a future that immediately resolves (no progress report, since the block was already reported by the term that triggered the download). Otherwise, spawns a task that calls retrieve_data, which uses single-flight to ensure only one download per xorb block (other callers wait without acquiring CAS permits).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileTerm
impl !RefUnwindSafe for FileTerm
impl Send for FileTerm
impl Sync for FileTerm
impl Unpin for FileTerm
impl UnsafeUnpin for FileTerm
impl !UnwindSafe for FileTerm
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,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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