pub struct ProbeClassifierState<G> {
active_neighbor_probes: Cache<(HoprPseudonym, NeighborProbe), (Box<NodeId>, Duration, Option<PingQueryReplier>)>,
active_path_probes: Cache<Tag, (PathTelemetry, Arc<AllocatedTag>)>,
network_graph: G,
}Expand description
Shared state used to classify incoming messages as probe or non-probe.
Obtained from Probe::continuously_scan. Use filter_stream
to wrap an incoming stream so that probe messages are consumed internally and non-probe messages
are yielded to the caller.
Fields§
§active_neighbor_probes: Cache<(HoprPseudonym, NeighborProbe), (Box<NodeId>, Duration, Option<PingQueryReplier>)>§active_path_probes: Cache<Tag, (PathTelemetry, Arc<AllocatedTag>)>§network_graph: GImplementations§
Source§impl<G> ProbeClassifierState<G>
impl<G> ProbeClassifierState<G>
Sourcepub async fn classify<T>(
&self,
push_to_network: T,
pseudonym: HoprPseudonym,
in_data: ApplicationDataIn,
) -> ProbeDispatch
pub async fn classify<T>( &self, push_to_network: T, pseudonym: HoprPseudonym, in_data: ApplicationDataIn, ) -> ProbeDispatch
Classify one incoming (pseudonym, data) pair.
The push_to_network sink is used to send pong replies when the message is a Ping.
Returns Consumed if the message was a probe, or Passthrough for all other messages.
Sourcepub fn filter_stream<T, S>(
self,
push_to_network: T,
stream: S,
) -> impl Stream<Item = (HoprPseudonym, ApplicationDataIn)>
pub fn filter_stream<T, S>( self, push_to_network: T, stream: S, ) -> impl Stream<Item = (HoprPseudonym, ApplicationDataIn)>
Wraps stream as an in-place filter: probe messages are handled internally (telemetry,
pong replies via push_to_network), non-probe messages are yielded.
Trait Implementations§
Source§impl<G: Clone> Clone for ProbeClassifierState<G>
impl<G: Clone> Clone for ProbeClassifierState<G>
Source§fn clone(&self) -> ProbeClassifierState<G>
fn clone(&self) -> ProbeClassifierState<G>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<G> Freeze for ProbeClassifierState<G>where
G: Freeze,
impl<G> !RefUnwindSafe for ProbeClassifierState<G>
impl<G> Send for ProbeClassifierState<G>where
G: Send,
impl<G> Sync for ProbeClassifierState<G>where
G: Sync,
impl<G> Unpin for ProbeClassifierState<G>where
G: Unpin,
impl<G> !UnwindSafe for ProbeClassifierState<G>
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,
§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