hopr_path/selectors/
mod.rs1pub mod dfs;
2
3use std::ops::Add;
4
5use async_trait::async_trait;
6use hopr_internal_types::prelude::*;
7use hopr_primitive_types::primitives::Address;
8
9use crate::{ChannelPath, channel_graph::ChannelEdge, errors::Result};
10
11pub trait EdgeWeighting<W>
13where
14 W: Default + Add<W, Output = W>,
15{
16 fn calculate_weight(channel: &ChannelEdge) -> W;
18}
19
20#[async_trait]
22pub trait PathSelector {
23 async fn select_path(
27 &self,
28 source: Address,
29 destination: Address,
30 min_hops: usize,
31 max_hops: usize,
32 ) -> Result<ChannelPath>;
33
34 async fn select_auto_path(&self, source: Address, destination: Address) -> Result<ChannelPath> {
37 self.select_path(source, destination, 1usize, INTERMEDIATE_HOPS).await
38 }
39}