1pub use hopr_network_types::types::DestinationRouting;
2use multiaddr::PeerId;
3
4use super::{MeasurableNeighbor, MeasurablePath, Telemetry, TrafficGenerationError};
5
6#[async_trait::async_trait]
8pub trait NetworkGraphView {
9 fn nodes(&self) -> futures::stream::BoxStream<'static, PeerId>;
11
12 async fn find_routes(&self, destination: &PeerId, length: usize) -> Vec<DestinationRouting>;
14}
15
16#[async_trait::async_trait]
18pub trait NetworkGraphUpdate {
19 async fn record<N, P>(&self, telemetry: std::result::Result<Telemetry<N, P>, TrafficGenerationError<P>>)
21 where
22 N: MeasurableNeighbor + Clone + Send + Sync + 'static,
23 P: MeasurablePath + Clone + Send + Sync + 'static;
24}
25
26pub trait TrafficGeneration {
36 fn build<T>(self, network_graph: T) -> impl futures::Stream<Item = DestinationRouting> + Send
37 where
38 T: NetworkGraphView + Send + Sync + 'static;
39}