Struct holochain::prelude::dependencies::kitsune_p2p_fetch::FetchPool
pub struct FetchPool { /* private fields */ }
Expand description
A FetchPool tracks a set of FetchKey
s (op hashes) to be fetched,
each of which can have multiple sources associated with it.
When adding the same key twice, the sources are merged by appending the newest
source to the front of the list of sources, and the contexts are merged by the
method defined in FetchPoolConfig
.
The queue items can be accessed only through its Iterator implementation. Each item contains a FetchKey and one Source agent from which to fetch it. Each time an item is obtained in this way, it is moved to the end of the list. It is important to use the iterator lazily, and only take what is needed. Accessing any item through iteration implies that a fetch was attempted.
Implementations§
§impl FetchPool
impl FetchPool
pub fn new(config: Arc<dyn FetchPoolConfig>) -> FetchPool
pub fn new(config: Arc<dyn FetchPoolConfig>) -> FetchPool
Constructor
pub fn new_bitwise_or() -> FetchPool
pub fn new_bitwise_or() -> FetchPool
Constructor, using only the “hardcoded” config (TODO: remove)
pub fn push(&self, args: FetchPoolPush)
pub fn push(&self, args: FetchPoolPush)
Add an item to the queue. If the FetchKey does not already exist, add it to the end of the queue. If the FetchKey exists, add the new source and merge the context in, without changing the position in the queue.
pub fn remove(&self, key: &FetchKey) -> Option<FetchPoolItem>
pub fn remove(&self, key: &FetchKey) -> Option<FetchPoolItem>
When an item has been successfully fetched, we can remove it from the queue.
pub fn get_items_to_fetch(
&self
) -> Vec<(FetchKey, Arc<KitsuneSpace>, FetchSource, Option<FetchContext>)>
pub fn get_items_to_fetch( &self ) -> Vec<(FetchKey, Arc<KitsuneSpace>, FetchSource, Option<FetchContext>)>
Get a list of the next items that should be fetched.
Trait Implementations§
§impl From<FetchPool> for FetchPoolReader
impl From<FetchPool> for FetchPoolReader
§fn from(original: FetchPool) -> FetchPoolReader
fn from(original: FetchPool) -> FetchPoolReader
Auto Trait Implementations§
impl !RefUnwindSafe for FetchPool
impl Send for FetchPool
impl Sync for FetchPool
impl Unpin for FetchPool
impl !UnwindSafe for FetchPool
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> 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> ⓘ
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.