@@ -58,6 +58,7 @@ pub(crate) enum ProbingStrategyKind {
5858/// [`custom`]: Self::custom
5959/// [`build`]: ProbingConfigBuilder::build
6060#[ derive( Clone ) ]
61+ #[ cfg_attr( feature = "uniffi" , derive( uniffi:: Object ) ) ]
6162pub struct ProbingConfig {
6263 pub ( crate ) kind : ProbingStrategyKind ,
6364 pub ( crate ) interval : Duration ,
@@ -108,6 +109,60 @@ impl ProbingConfig {
108109 }
109110}
110111
112+ #[ cfg( feature = "uniffi" ) ]
113+ #[ uniffi:: export]
114+ impl ProbingConfig {
115+ /// Creates a probing config that probes toward the highest-degree nodes in the graph.
116+ ///
117+ /// `top_node_count` controls how many of the most-connected nodes are cycled through.
118+ /// All other parameters are optional and fall back to sensible defaults when `None`.
119+ #[ uniffi:: constructor]
120+ pub fn new_high_degree (
121+ top_node_count : u64 , interval_secs : Option < u64 > , max_locked_msat : Option < u64 > ,
122+ diversity_penalty_msat : Option < u64 > , cooldown_secs : Option < u64 > ,
123+ ) -> Self {
124+ let mut builder = Self :: high_degree ( top_node_count as usize ) ;
125+ if let Some ( secs) = interval_secs {
126+ builder = builder. interval ( Duration :: from_secs ( secs) ) ;
127+ }
128+ if let Some ( msat) = max_locked_msat {
129+ builder = builder. max_locked_msat ( msat) ;
130+ }
131+ if let Some ( penalty) = diversity_penalty_msat {
132+ builder = builder. diversity_penalty_msat ( penalty) ;
133+ }
134+ if let Some ( secs) = cooldown_secs {
135+ builder = builder. cooldown ( Duration :: from_secs ( secs) ) ;
136+ }
137+ builder. build ( )
138+ }
139+
140+ /// Creates a probing config that probes via random graph walks.
141+ ///
142+ /// `max_hops` is the upper bound on the number of hops in a randomly constructed path.
143+ /// All other parameters are optional and fall back to sensible defaults when `None`.
144+ #[ uniffi:: constructor]
145+ pub fn new_random_walk (
146+ max_hops : u64 , interval_secs : Option < u64 > , max_locked_msat : Option < u64 > ,
147+ diversity_penalty_msat : Option < u64 > , cooldown_secs : Option < u64 > ,
148+ ) -> Self {
149+ let mut builder = Self :: random_walk ( max_hops as usize ) ;
150+ if let Some ( secs) = interval_secs {
151+ builder = builder. interval ( Duration :: from_secs ( secs) ) ;
152+ }
153+ if let Some ( msat) = max_locked_msat {
154+ builder = builder. max_locked_msat ( msat) ;
155+ }
156+ if let Some ( penalty) = diversity_penalty_msat {
157+ builder = builder. diversity_penalty_msat ( penalty) ;
158+ }
159+ if let Some ( secs) = cooldown_secs {
160+ builder = builder. cooldown ( Duration :: from_secs ( secs) ) ;
161+ }
162+ builder. build ( )
163+ }
164+ }
165+
111166/// Builder for [`ProbingConfig`].
112167///
113168/// Created via [`ProbingConfig::high_degree`], [`ProbingConfig::random_walk`], or
0 commit comments