Struct holochain::prelude::kitsune_p2p::dependencies::kitsune_p2p_fetch::FetchQueue
pub struct FetchQueue { /* private fields */ }
Expand description
A FetchQueue tracks a set of FetchKey
s (op hashes or regions) 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 FetchQueueConfig
.
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 FetchQueue
impl FetchQueue
pub fn new(config: Arc<dyn FetchQueueConfig + 'static>) -> FetchQueue
pub fn new(config: Arc<dyn FetchQueueConfig + 'static>) -> FetchQueue
Constructor
pub fn new_bitwise_or() -> FetchQueue
pub fn new_bitwise_or() -> FetchQueue
Constructor, using only the “hardcoded” config (TODO: remove)
pub fn push(&self, args: FetchQueuePush)
pub fn push(&self, args: FetchQueuePush)
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<FetchQueueItem>
pub fn remove(&self, key: &FetchKey) -> Option<FetchQueueItem>
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>), Global> ⓘ
pub fn get_items_to_fetch(
&self
) -> Vec<(FetchKey, Arc<KitsuneSpace>, FetchSource, Option<FetchContext>), Global> ⓘ
Get a list of the next items that should be fetched.
Trait Implementations§
§impl Clone for FetchQueue
impl Clone for FetchQueue
§fn clone(&self) -> FetchQueue
fn clone(&self) -> FetchQueue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for FetchQueue
impl Debug for FetchQueue
§impl From<FetchQueue> for FetchQueueReader
impl From<FetchQueue> for FetchQueueReader
§fn from(original: FetchQueue) -> FetchQueueReader
fn from(original: FetchQueue) -> FetchQueueReader
Auto Trait Implementations§
impl !RefUnwindSafe for FetchQueue
impl Send for FetchQueue
impl Sync for FetchQueue
impl Unpin for FetchQueue
impl !UnwindSafe for FetchQueue
Blanket Implementations§
§impl<T> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
§fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
§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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
§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>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§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> 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.