Skip to content

Commit d3884bc

Browse files
committed
fixup! feat: introduce and configure node with tiered KVStore
remove features relating to retry configuration and reading/listing from backup store as a fallback strategy
1 parent 71f2e2a commit d3884bc

7 files changed

Lines changed: 77 additions & 400 deletions

File tree

bindings/ldk_node.udl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ enum WordCount {
7979
"Words24",
8080
};
8181

82-
dictionary RetryConfig {
83-
u16 initial_retry_delay_ms;
84-
u16 maximum_delay_ms;
85-
f32 backoff_multiplier;
86-
};
87-
8882
enum LogLevel {
8983
"Gossip",
9084
"Trace",
@@ -180,7 +174,6 @@ interface Builder {
180174
void set_announcement_addresses(sequence<SocketAddress> announcement_addresses);
181175
[Throws=BuildError]
182176
void set_node_alias(string node_alias);
183-
void set_tier_store_retry_config(RetryConfig retry_config);
184177
void set_tier_store_backup(FfiDynStore backup_store);
185178
void set_tier_store_ephemeral(FfiDynStore ephemeral_store);
186179
[Throws=BuildError]

bindings/python/src/ldk_node/test_ldk_node.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,7 @@ def setup_node_with_tier_store(tmp_dir, esplora_endpoint, listening_addresses):
168168
primary = TestKvStore("primary")
169169
backup = TestKvStore("backup")
170170
ephemeral = TestKvStore("ephemeral")
171-
retry_config = RetryConfig(
172-
initial_retry_delay_ms=10,
173-
maximum_delay_ms=100,
174-
backoff_multiplier=2.0
175-
)
176-
171+
177172
# Set event loop for async Python callbacks from Rust
178173
# (https://mozilla.github.io/uniffi-rs/0.27/futures.html#python-uniffi_set_event_loop)
179174
loop = asyncio.new_event_loop()
@@ -191,7 +186,6 @@ def run_loop():
191186
builder.set_chain_source_esplora(esplora_endpoint, None)
192187
builder.set_network(DEFAULT_TEST_NETWORK)
193188
builder.set_listening_addresses(listening_addresses)
194-
builder.set_tier_store_retry_config(retry_config)
195189
builder.set_tier_store_backup(FfiDynStore.from_store(backup))
196190
builder.set_tier_store_ephemeral(FfiDynStore.from_store(ephemeral))
197191

src/builder.rs

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use crate::fee_estimator::OnchainFeeEstimator;
5656
use crate::ffi::FfiDynStore;
5757
use crate::gossip::GossipSource;
5858
use crate::io::sqlite_store::SqliteStore;
59-
use crate::io::tier_store::{RetryConfig, TierStore};
59+
use crate::io::tier_store::TierStore;
6060
use crate::io::utils::{
6161
read_event_queue, read_external_pathfinding_scores_from_cache, read_network_graph,
6262
read_node_metrics, read_output_sweeper, read_payments, read_peer_info, read_pending_payments,
@@ -157,15 +157,13 @@ impl std::fmt::Debug for LogWriterConfig {
157157
struct TierStoreConfig {
158158
ephemeral: Option<Arc<DynStore>>,
159159
backup: Option<Arc<DynStore>>,
160-
retry: Option<RetryConfig>,
161160
}
162161

163162
impl std::fmt::Debug for TierStoreConfig {
164163
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
165164
f.debug_struct("TierStoreConfig")
166165
.field("ephemeral", &self.ephemeral.as_ref().map(|_| "Arc<DynStore>"))
167166
.field("backup", &self.backup.as_ref().map(|_| "Arc<DynStore>"))
168-
.field("retry", &self.retry)
169167
.finish()
170168
}
171169
}
@@ -567,21 +565,6 @@ impl NodeBuilder {
567565
Ok(self)
568566
}
569567

570-
/// Configures retry behavior for transient errors when accessing the primary store.
571-
///
572-
/// When building with [`build_with_tier_store`], controls the exponential backoff parameters
573-
/// used when retrying failed operations on the primary store due to transient errors
574-
/// (network issues, timeouts, etc.).
575-
///
576-
/// If not set, default retry parameters are used. See [`RetryConfig`] for details.
577-
///
578-
/// [`build_with_tier_store`]: Self::build_with_tier_store
579-
pub fn set_tier_store_retry_config(&mut self, config: RetryConfig) -> &mut Self {
580-
let tier_store_config = self.tier_store_config.get_or_insert(TierStoreConfig::default());
581-
tier_store_config.retry = Some(config);
582-
self
583-
}
584-
585568
/// Configures the backup store for local disaster recovery.
586569
///
587570
/// When building with [`build_with_tier_store`], this store receives asynchronous copies
@@ -744,37 +727,32 @@ impl NodeBuilder {
744727
///
745728
/// ## Configuration
746729
///
747-
/// Use the setter methods to configure optional stores and retry behavior:
730+
/// Use the setter methods to configure optional stores:
748731
/// - [`set_tier_store_ephemeral`] - Set local store for network graph and scorer
749732
/// - [`set_tier_store_backup`] - Set local backup store for disaster recovery
750-
/// - [`set_tier_store_retry_config`] - Configure retry delays and backoff for transient errors
751733
///
752734
/// ## Example
753735
///
754736
/// ```ignore
755737
/// # use ldk_node::{Builder, Config};
756-
/// # use ldk_node::io::tier_store::RetryConfig;
757738
/// # use std::sync::Arc;
758739
/// let config = Config::default();
759740
/// let mut builder = NodeBuilder::from_config(config);
760741
///
761742
/// let primary = Arc::new(VssStore::new(...));
762743
/// let ephemeral = Arc::new(FilesystemStore::new(...));
763744
/// let backup = Arc::new(SqliteStore::new(...));
764-
/// let retry_config = RetryConfig::default();
765745
///
766746
/// builder
767747
/// .set_tier_store_ephemeral(ephemeral)
768-
/// .set_tier_store_backup(backup)
769-
/// .set_tier_store_retry_config(retry_config);
748+
/// .set_tier_store_backup(backup);
770749
///
771750
/// let node = builder.build_with_tier_store(primary)?;
772751
/// # Ok::<(), ldk_node::BuildError>(())
773752
/// ```
774753
///
775754
/// [`set_tier_store_ephemeral`]: Self::set_tier_store_ephemeral
776755
/// [`set_tier_store_backup`]: Self::set_tier_store_backup
777-
/// [`set_tier_store_retry_config`]: Self::set_tier_store_retry_config
778756
#[cfg(not(feature = "uniffi"))]
779757
pub fn build_with_tier_store(
780758
&self, node_entropy: NodeEntropy, primary_store: Arc<DynStore>,
@@ -796,10 +774,9 @@ impl NodeBuilder {
796774
};
797775

798776
let ts_config = self.tier_store_config.as_ref();
799-
let retry_config = ts_config.and_then(|c| c.retry).unwrap_or_default();
800777

801778
let mut tier_store =
802-
TierStore::new(primary_store, Arc::clone(&runtime), Arc::clone(&logger), retry_config);
779+
TierStore::new(primary_store, Arc::clone(&runtime), Arc::clone(&logger));
803780

804781
if let Some(config) = ts_config {
805782
config.ephemeral.as_ref().map(|s| tier_store.set_ephemeral_store(Arc::clone(s)));
@@ -1074,19 +1051,6 @@ impl ArcedNodeBuilder {
10741051
self.inner.write().unwrap().set_async_payments_role(role).map(|_| ())
10751052
}
10761053

1077-
/// Configures retry behavior for transient errors when accessing the primary store.
1078-
///
1079-
/// When building with [`build_with_tier_store`], controls the exponential backoff parameters
1080-
/// used when retrying failed operations on the primary store due to transient errors
1081-
/// (network issues, timeouts, etc.).
1082-
///
1083-
/// If not set, default retry parameters are used. See [`RetryConfig`] for details.
1084-
///
1085-
/// [`build_with_tier_store`]: Self::build_with_tier_store
1086-
pub fn set_tier_store_retry_config(&self, config: RetryConfig) {
1087-
self.inner.write().unwrap().set_tier_store_retry_config(config);
1088-
}
1089-
10901054
/// Configures the backup store for local disaster recovery.
10911055
///
10921056
/// When building with [`build_with_tier_store`], this store receives asynchronous copies

0 commit comments

Comments
 (0)