Trait LockableScore
pub trait LockableScore<'a> {
type ScoreUpdate: 'a + ScoreUpdate;
type ScoreLookUp: 'a + ScoreLookUp;
type WriteLocked: DerefMut<Target = Self::ScoreUpdate>;
type ReadLocked: Deref<Target = Self::ScoreLookUp>;
// Required methods
fn read_lock(&'a self) -> Self::ReadLocked;
fn write_lock(&'a self) -> Self::WriteLocked;
}
Expand description
A scorer that is accessed under a lock.
Needed so that calls to ScoreLookUp::channel_penalty_msat
in find_route
can be made while
having shared ownership of a scorer but without requiring internal locking in ScoreUpdate
implementations. Internal locking would be detrimental to route finding performance and could
result in ScoreLookUp::channel_penalty_msat
returning a different value for the same channel.
Required Associated Types§
type ScoreUpdate: 'a + ScoreUpdate
type ScoreUpdate: 'a + ScoreUpdate
The ScoreUpdate
type.
type ScoreLookUp: 'a + ScoreLookUp
type ScoreLookUp: 'a + ScoreLookUp
The ScoreLookUp
type.
type WriteLocked: DerefMut<Target = Self::ScoreUpdate>
type WriteLocked: DerefMut<Target = Self::ScoreUpdate>
The write locked ScoreUpdate
type.
type ReadLocked: Deref<Target = Self::ScoreLookUp>
type ReadLocked: Deref<Target = Self::ScoreLookUp>
The read locked ScoreLookUp
type.
Required Methods§
fn read_lock(&'a self) -> Self::ReadLocked
fn read_lock(&'a self) -> Self::ReadLocked
Returns read locked scorer.
fn write_lock(&'a self) -> Self::WriteLocked
fn write_lock(&'a self) -> Self::WriteLocked
Returns write locked scorer.