pub struct DfsPathSelector<CW> { /* private fields */ }
Expand description
Path selector using depth-first search of the channel graph.
Implementations§
Source§impl<CW: EdgeWeighting<U256>> DfsPathSelector<CW>
impl<CW: EdgeWeighting<U256>> DfsPathSelector<CW>
Sourcepub fn new(graph: Arc<RwLock<ChannelGraph>>, cfg: DfsPathSelectorConfig) -> Self
pub fn new(graph: Arc<RwLock<ChannelGraph>>, cfg: DfsPathSelectorConfig) -> Self
Creates a new path selector with the given config and
ChannelGraph
.
Trait Implementations§
Source§impl<CW: Clone> Clone for DfsPathSelector<CW>
impl<CW: Clone> Clone for DfsPathSelector<CW>
Source§fn clone(&self) -> DfsPathSelector<CW>
fn clone(&self) -> DfsPathSelector<CW>
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 moreSource§impl<CW: Debug> Debug for DfsPathSelector<CW>
impl<CW: Debug> Debug for DfsPathSelector<CW>
Source§impl<CW> PathSelector for DfsPathSelector<CW>
impl<CW> PathSelector for DfsPathSelector<CW>
Source§fn select_path<'life0, 'async_trait>(
&'life0 self,
source: Address,
destination: Address,
min_hops: usize,
max_hops: usize,
) -> Pin<Box<dyn Future<Output = Result<ChannelPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn select_path<'life0, 'async_trait>(
&'life0 self,
source: Address,
destination: Address,
min_hops: usize,
max_hops: usize,
) -> Pin<Box<dyn Future<Output = Result<ChannelPath>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Attempts to find a path with at least min_hops
hops and at most max_hops
hops
that goes from source
to destination
. There does not need to be
a payment channel to destination
, so the path only includes intermediate hops.
The function implements a randomized best-first search through the path space. The graph
traversal is bounded by self.max_iterations
to prevent from long-running path
selection runs.
Source§fn select_auto_path<'life0, 'async_trait>(
&'life0 self,
source: Address,
destination: Address,
) -> Pin<Box<dyn Future<Output = Result<ChannelPath>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn select_auto_path<'life0, 'async_trait>(
&'life0 self,
source: Address,
destination: Address,
) -> Pin<Box<dyn Future<Output = Result<ChannelPath>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Constructs a new valid packet
Path
from source to the given destination.
This method uses INTERMEDIATE_HOPS
as the maximum number of hops.Auto Trait Implementations§
impl<CW> Freeze for DfsPathSelector<CW>
impl<CW> !RefUnwindSafe for DfsPathSelector<CW>
impl<CW> Send for DfsPathSelector<CW>where
CW: Send,
impl<CW> Sync for DfsPathSelector<CW>where
CW: Sync,
impl<CW> Unpin for DfsPathSelector<CW>where
CW: Unpin,
impl<CW> !UnwindSafe for DfsPathSelector<CW>
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> 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> 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