pub struct Fetcher { /* private fields */ }Expand description
Fetcher for remote content
Implementations§
Source§impl Fetcher
impl Fetcher
Sourcepub fn new(config: FetchConfig) -> Self
pub fn new(config: FetchConfig) -> Self
Create a new fetcher with the given config BlossomClient auto-loads servers from ~/.hashtree/config.toml
Sourcepub fn with_keys(config: FetchConfig, keys: Keys) -> Self
pub fn with_keys(config: FetchConfig, keys: Keys) -> Self
Create a new fetcher with specific keys (for authenticated uploads)
Sourcepub fn blossom(&self) -> &BlossomClient
pub fn blossom(&self) -> &BlossomClient
Get the underlying BlossomClient
Sourcepub async fn fetch_chunk(
&self,
webrtc_state: Option<&Arc<WebRTCState>>,
hash_hex: &str,
) -> Result<Vec<u8>>
pub async fn fetch_chunk( &self, webrtc_state: Option<&Arc<WebRTCState>>, hash_hex: &str, ) -> Result<Vec<u8>>
Fetch a single chunk by hash, trying WebRTC first then Blossom
Sourcepub async fn fetch_chunk_with_store(
&self,
store: &HashtreeStore,
webrtc_state: Option<&Arc<WebRTCState>>,
hash: &[u8; 32],
) -> Result<Vec<u8>>
pub async fn fetch_chunk_with_store( &self, store: &HashtreeStore, webrtc_state: Option<&Arc<WebRTCState>>, hash: &[u8; 32], ) -> Result<Vec<u8>>
Fetch a chunk, checking local storage first
Sourcepub async fn fetch_tree(
&self,
store: &HashtreeStore,
webrtc_state: Option<&Arc<WebRTCState>>,
root_hash: &[u8; 32],
) -> Result<(usize, u64)>
pub async fn fetch_tree( &self, store: &HashtreeStore, webrtc_state: Option<&Arc<WebRTCState>>, root_hash: &[u8; 32], ) -> Result<(usize, u64)>
Fetch an entire tree (all chunks recursively) - sequential version Returns (chunks_fetched, bytes_fetched)
Sourcepub async fn fetch_tree_parallel(
&self,
store: &HashtreeStore,
webrtc_state: Option<&Arc<WebRTCState>>,
root_hash: &[u8; 32],
concurrency: usize,
) -> Result<(usize, u64)>
pub async fn fetch_tree_parallel( &self, store: &HashtreeStore, webrtc_state: Option<&Arc<WebRTCState>>, root_hash: &[u8; 32], concurrency: usize, ) -> Result<(usize, u64)>
Fetch an entire tree with parallel downloads
Uses work-stealing: always keeps concurrency requests in flight
Returns (chunks_fetched, bytes_fetched)
Sourcepub async fn fetch_file(
&self,
store: &HashtreeStore,
webrtc_state: Option<&Arc<WebRTCState>>,
hash: &[u8; 32],
) -> Result<Option<Vec<u8>>>
pub async fn fetch_file( &self, store: &HashtreeStore, webrtc_state: Option<&Arc<WebRTCState>>, hash: &[u8; 32], ) -> Result<Option<Vec<u8>>>
Fetch a file by hash, fetching all chunks if needed Returns the complete file content
Sourcepub async fn fetch_directory(
&self,
store: &HashtreeStore,
webrtc_state: Option<&Arc<WebRTCState>>,
hash: &[u8; 32],
) -> Result<Option<DirectoryListing>>
pub async fn fetch_directory( &self, store: &HashtreeStore, webrtc_state: Option<&Arc<WebRTCState>>, hash: &[u8; 32], ) -> Result<Option<DirectoryListing>>
Fetch a directory listing, fetching chunks if needed
Auto Trait Implementations§
impl !Freeze for Fetcher
impl !RefUnwindSafe for Fetcher
impl Send for Fetcher
impl Sync for Fetcher
impl Unpin for Fetcher
impl UnsafeUnpin for Fetcher
impl !UnwindSafe for Fetcher
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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