UNPKG

lightningdevkit

Version:
35 lines (34 loc) 1.27 kB
import { ScoreLookUp } from '../structs/ScoreLookUp.mjs'; import { ScoreUpdate } from '../structs/ScoreUpdate.mjs'; import { CommonBase } from './CommonBase.mjs'; /** An implementation of LockableScore */ export interface LockableScoreInterface { /**Returns read locked scorer. */ read_lock(): ScoreLookUp; /**Returns write locked scorer. */ write_lock(): ScoreUpdate; } /** * 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. * * [`find_route`]: crate::routing::router::find_route */ export declare class LockableScore extends CommonBase { /** Creates a new instance of LockableScore from a given implementation */ static new_impl(arg: LockableScoreInterface): LockableScore; /** * Returns read locked scorer. */ read_lock(): ScoreLookUp; /** * Returns write locked scorer. */ write_lock(): ScoreUpdate; }