Skip to content

Commit a5d3546

Browse files
committed
Rename KVStore trait to KVStoreSync
1 parent 22cfb54 commit a5d3546

File tree

8 files changed

+59
-58
lines changed

8 files changed

+59
-58
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use lightning::sign::EntropySource;
4242
use lightning::sign::OutputSpender;
4343
use lightning::util::logger::Logger;
4444
use lightning::util::persist::{
45-
KVStore, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
45+
KVStoreSync, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
4646
CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_KEY,
4747
NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE,
4848
SCORER_PERSISTENCE_KEY, SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
@@ -690,8 +690,8 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
690690
/// # impl lightning::util::logger::Logger for Logger {
691691
/// # fn log(&self, _record: lightning::util::logger::Record) {}
692692
/// # }
693-
/// # struct Store {}
694-
/// # impl lightning::util::persist::KVStore for Store {
693+
/// # struct StoreSync {}
694+
/// # impl lightning::util::persist::KVStoreSync for StoreSync {
695695
/// # fn read(&self, primary_namespace: &str, secondary_namespace: &str, key: &str) -> io::Result<Vec<u8>> { Ok(Vec::new()) }
696696
/// # fn write(&self, primary_namespace: &str, secondary_namespace: &str, key: &str, buf: &[u8]) -> io::Result<()> { Ok(()) }
697697
/// # fn remove(&self, primary_namespace: &str, secondary_namespace: &str, key: &str, lazy: bool) -> io::Result<()> { Ok(()) }
@@ -707,14 +707,14 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
707707
/// # fn send_data(&mut self, _data: &[u8], _resume_read: bool) -> usize { 0 }
708708
/// # fn disconnect_socket(&mut self) {}
709709
/// # }
710-
/// # type ChainMonitor<B, F, FE> = lightning::chain::chainmonitor::ChainMonitor<lightning::sign::InMemorySigner, Arc<F>, Arc<B>, Arc<FE>, Arc<Logger>, Arc<Store>, Arc<lightning::sign::KeysManager>>;
710+
/// # type ChainMonitor<B, F, FE> = lightning::chain::chainmonitor::ChainMonitor<lightning::sign::InMemorySigner, Arc<F>, Arc<B>, Arc<FE>, Arc<Logger>, Arc<StoreSync>, Arc<lightning::sign::KeysManager>>;
711711
/// # type NetworkGraph = lightning::routing::gossip::NetworkGraph<Arc<Logger>>;
712712
/// # type P2PGossipSync<UL> = lightning::routing::gossip::P2PGossipSync<Arc<NetworkGraph>, Arc<UL>, Arc<Logger>>;
713713
/// # type ChannelManager<B, F, FE> = lightning::ln::channelmanager::SimpleArcChannelManager<ChainMonitor<B, F, FE>, B, FE, Logger>;
714714
/// # type OnionMessenger<B, F, FE> = lightning::onion_message::messenger::OnionMessenger<Arc<lightning::sign::KeysManager>, Arc<lightning::sign::KeysManager>, Arc<Logger>, Arc<ChannelManager<B, F, FE>>, Arc<lightning::onion_message::messenger::DefaultMessageRouter<Arc<NetworkGraph>, Arc<Logger>, Arc<lightning::sign::KeysManager>>>, Arc<ChannelManager<B, F, FE>>, lightning::ln::peer_handler::IgnoringMessageHandler, lightning::ln::peer_handler::IgnoringMessageHandler, lightning::ln::peer_handler::IgnoringMessageHandler>;
715715
/// # type LiquidityManager<B, F, FE> = lightning_liquidity::LiquidityManager<Arc<lightning::sign::KeysManager>, Arc<ChannelManager<B, F, FE>>, Arc<F>>;
716716
/// # type Scorer = RwLock<lightning::routing::scoring::ProbabilisticScorer<Arc<NetworkGraph>, Arc<Logger>>>;
717-
/// # type PeerManager<B, F, FE, UL> = lightning::ln::peer_handler::SimpleArcPeerManager<SocketDescriptor, ChainMonitor<B, F, FE>, B, FE, Arc<UL>, Logger, F, Store>;
717+
/// # type PeerManager<B, F, FE, UL> = lightning::ln::peer_handler::SimpleArcPeerManager<SocketDescriptor, ChainMonitor<B, F, FE>, B, FE, Arc<UL>, Logger, F, StoreSync>;
718718
/// #
719719
/// # struct Node<
720720
/// # B: lightning::chain::chaininterface::BroadcasterInterface + Send + Sync + 'static,
@@ -731,7 +731,7 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
731731
/// # liquidity_manager: Arc<LiquidityManager<B, F, FE>>,
732732
/// # chain_monitor: Arc<ChainMonitor<B, F, FE>>,
733733
/// # gossip_sync: Arc<P2PGossipSync<UL>>,
734-
/// # persister: Arc<Store>,
734+
/// # persister: Arc<StoreSync>,
735735
/// # logger: Arc<Logger>,
736736
/// # scorer: Arc<Scorer>,
737737
/// # sweeper: Arc<OutputSweeper<Arc<B>, Arc<D>, Arc<FE>, Arc<F>, Arc<Store>, Arc<Logger>, Arc<O>>>,
@@ -856,7 +856,7 @@ where
856856
LM::Target: ALiquidityManager,
857857
O::Target: 'static + OutputSpender,
858858
D::Target: 'static + ChangeDestinationSource,
859-
K::Target: 'static + KVStore,
859+
K::Target: 'static + KVStoreSync,
860860
{
861861
let mut should_break = false;
862862
let async_event_handler = |event| {
@@ -1055,7 +1055,7 @@ impl BackgroundProcessor {
10551055
LM::Target: ALiquidityManager,
10561056
D::Target: ChangeDestinationSourceSync,
10571057
O::Target: 'static + OutputSpender,
1058-
K::Target: 'static + KVStore,
1058+
K::Target: 'static + KVStoreSync,
10591059
{
10601060
let stop_thread = Arc::new(AtomicBool::new(false));
10611061
let stop_thread_clone = Arc::clone(&stop_thread);
@@ -1228,7 +1228,8 @@ mod tests {
12281228
use lightning::types::payment::PaymentHash;
12291229
use lightning::util::config::UserConfig;
12301230
use lightning::util::persist::{
1231-
KVStore, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
1231+
KVStoreSync, CHANNEL_MANAGER_PERSISTENCE_KEY,
1232+
CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
12321233
CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_KEY,
12331234
NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE,
12341235
SCORER_PERSISTENCE_KEY, SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
@@ -1466,7 +1467,7 @@ mod tests {
14661467
}
14671468
}
14681469

1469-
impl KVStore for Persister {
1470+
impl KVStoreSync for Persister {
14701471
fn read(
14711472
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
14721473
) -> lightning::io::Result<Vec<u8>> {

lightning-liquidity/tests/common/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use lightning::routing::scoring::{ChannelUsage, ScoreLookUp, ScoreUpdate};
2727
use lightning::sign::{InMemorySigner, KeysManager};
2828
use lightning::util::config::UserConfig;
2929
use lightning::util::persist::{
30-
KVStore, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
30+
KVStoreSync, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
3131
CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_KEY,
3232
NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE,
3333
SCORER_PERSISTENCE_KEY, SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
@@ -194,7 +194,7 @@ impl Persister {
194194
}
195195
}
196196

197-
impl KVStore for Persister {
197+
impl KVStoreSync for Persister {
198198
fn read(
199199
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
200200
) -> lightning::io::Result<Vec<u8>> {

lightning-persister/src/fs_store.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use crate::utils::{check_namespace_key_validity, is_valid_kvstore_str};
33

44
use lightning::types::string::PrintableString;
5-
use lightning::util::persist::{KVStore, MigratableKVStore};
5+
use lightning::util::persist::{KVStoreSync, MigratableKVStore};
66

77
use std::collections::HashMap;
88
use std::fs;
@@ -33,7 +33,7 @@ fn path_to_windows_str<T: AsRef<OsStr>>(path: &T) -> Vec<u16> {
3333
// The number of read/write/remove/list operations after which we clean up our `locks` HashMap.
3434
const GC_LOCK_INTERVAL: usize = 25;
3535

36-
/// A [`KVStore`] implementation that writes to and reads from the file system.
36+
/// A [`KVStoreSync`] implementation that writes to and reads from the file system.
3737
pub struct FilesystemStore {
3838
data_dir: PathBuf,
3939
tmp_file_counter: AtomicUsize,
@@ -92,7 +92,7 @@ impl FilesystemStore {
9292
}
9393
}
9494

95-
impl KVStore for FilesystemStore {
95+
impl KVStoreSync for FilesystemStore {
9696
fn read(
9797
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
9898
) -> lightning::io::Result<Vec<u8>> {

lightning-persister/src/test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ use lightning::ln::functional_test_utils::{
44
create_network, create_node_cfgs, create_node_chanmgrs, send_payment,
55
};
66
use lightning::util::persist::{
7-
migrate_kv_store_data, read_channel_monitors, KVStore, MigratableKVStore,
7+
migrate_kv_store_data, read_channel_monitors, KVStoreSync, MigratableKVStore,
88
KVSTORE_NAMESPACE_KEY_ALPHABET, KVSTORE_NAMESPACE_KEY_MAX_LEN,
99
};
1010
use lightning::util::test_utils;
1111
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
1212

1313
use std::panic::RefUnwindSafe;
1414

15-
pub(crate) fn do_read_write_remove_list_persist<K: KVStore + RefUnwindSafe>(kv_store: &K) {
15+
pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(kv_store: &K) {
1616
let data = [42u8; 32];
1717

1818
let primary_namespace = "testspace";
@@ -113,7 +113,7 @@ pub(crate) fn do_test_data_migration<S: MigratableKVStore, T: MigratableKVStore>
113113

114114
// Integration-test the given KVStore implementation. Test relaying a few payments and check that
115115
// the persisted data is updated the appropriate number of times.
116-
pub(crate) fn do_test_store<K: KVStore + Sync>(store_0: &K, store_1: &K) {
116+
pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {
117117
let chanmon_cfgs = create_chanmon_cfgs(2);
118118
let mut node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
119119
let chain_mon_0 = test_utils::TestChainMonitor::new(

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ where
18831883
/// - Perform any periodic channel and payment checks by calling [`timer_tick_occurred`] roughly
18841884
/// every minute
18851885
/// - Persist to disk whenever [`get_and_clear_needs_persistence`] returns `true` using a
1886-
/// [`Persister`] such as a [`KVStore`] implementation
1886+
/// [`Persister`] such as a [`KVStoreSync`] implementation
18871887
/// - Handle [`Event`]s obtained via its [`EventsProvider`] implementation
18881888
///
18891889
/// The [`Future`] returned by [`get_event_or_persistence_needed_future`] is useful in determining
@@ -2466,7 +2466,7 @@ where
24662466
/// [`timer_tick_occurred`]: Self::timer_tick_occurred
24672467
/// [`get_and_clear_needs_persistence`]: Self::get_and_clear_needs_persistence
24682468
/// [`Persister`]: crate::util::persist::Persister
2469-
/// [`KVStore`]: crate::util::persist::KVStore
2469+
/// [`KVStoreSync`]: crate::util::persist::KVStoreSync
24702470
/// [`get_event_or_persistence_needed_future`]: Self::get_event_or_persistence_needed_future
24712471
/// [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync
24722472
/// [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync

lightning/src/util/persist.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// You may not use this file except in accordance with one or both of these
55
// licenses.
66

7-
//! This module contains a simple key-value store trait [`KVStore`] that
7+
//! This module contains a simple key-value store trait [`KVStoreSync`] that
88
//! allows one to implement the persistence for [`ChannelManager`], [`NetworkGraph`],
99
//! and [`ChannelMonitor`] all in one place.
1010
//!
@@ -116,7 +116,7 @@ pub const MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL: &[u8] = &[0xFF; 2];
116116
/// **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister`
117117
/// interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace}/]]{key}` to
118118
/// recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`.
119-
pub trait KVStore {
119+
pub trait KVStoreSync {
120120
/// Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and
121121
/// `key`.
122122
///
@@ -139,7 +139,7 @@ pub trait KVStore {
139139
/// If the `lazy` flag is set to `true`, the backend implementation might choose to lazily
140140
/// remove the given `key` at some point in time after the method returns, e.g., as part of an
141141
/// eventual batch deletion of multiple keys. As a consequence, subsequent calls to
142-
/// [`KVStore::list`] might include the removed key until the changes are actually persisted.
142+
/// [`KVStoreSync::list`] might include the removed key until the changes are actually persisted.
143143
///
144144
/// Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent
145145
/// `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could
@@ -162,12 +162,12 @@ pub trait KVStore {
162162
) -> Result<Vec<String>, io::Error>;
163163
}
164164

165-
/// Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`]
165+
/// Provides additional interface methods that are required for [`KVStoreSync`]-to-[`KVStoreSync`]
166166
/// data migration.
167-
pub trait MigratableKVStore: KVStore {
167+
pub trait MigratableKVStore: KVStoreSync {
168168
/// Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples.
169169
///
170-
/// This is useful for migrating data from [`KVStore`] implementation to [`KVStore`]
170+
/// This is useful for migrating data from [`KVStoreSync`] implementation to [`KVStoreSync`]
171171
/// implementation.
172172
///
173173
/// Must exhaustively return all entries known to the store to ensure no data is missed, but
@@ -196,7 +196,7 @@ pub fn migrate_kv_store_data<S: MigratableKVStore, T: MigratableKVStore>(
196196
Ok(())
197197
}
198198

199-
impl<ChannelSigner: EcdsaChannelSigner, K: KVStore + ?Sized> Persist<ChannelSigner> for K {
199+
impl<ChannelSigner: EcdsaChannelSigner, K: KVStoreSync + ?Sized> Persist<ChannelSigner> for K {
200200
// TODO: We really need a way for the persister to inform the user that its time to crash/shut
201201
// down once these start returning failure.
202202
// Then we should return InProgress rather than UnrecoverableError, implying we should probably
@@ -264,7 +264,7 @@ pub fn read_channel_monitors<K: Deref, ES: Deref, SP: Deref>(
264264
kv_store: K, entropy_source: ES, signer_provider: SP,
265265
) -> Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>)>, io::Error>
266266
where
267-
K::Target: KVStore,
267+
K::Target: KVStoreSync,
268268
ES::Target: EntropySource + Sized,
269269
SP::Target: SignerProvider + Sized,
270270
{
@@ -309,15 +309,15 @@ where
309309
///
310310
/// # Overview
311311
///
312-
/// The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased
312+
/// The main benefit this provides over the [`KVStoreSync`]'s [`Persist`] implementation is decreased
313313
/// I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and
314314
/// deleting) and complexity. This is because it writes channel monitor differential updates,
315315
/// whereas the other (default) implementation rewrites the entire monitor on each update. For
316316
/// routing nodes, updates can happen many times per second to a channel, and monitors can be tens
317317
/// of megabytes (or more). Updates can be as small as a few hundred bytes.
318318
///
319319
/// Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with
320-
/// the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence,
320+
/// the default [`KVStoreSync`]'s [`Persist`] implementation. They have a prepended byte sequence,
321321
/// [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other
322322
/// persisters. This is because monitors written by this struct _may_ have unapplied updates. In
323323
/// order to downgrade, you must ensure that all updates are applied to the monitor, and remove the
@@ -369,7 +369,7 @@ where
369369
///
370370
/// ## EXTREMELY IMPORTANT
371371
///
372-
/// It is extremely important that your [`KVStore::read`] implementation uses the
372+
/// It is extremely important that your [`KVStoreSync::read`] implementation uses the
373373
/// [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in
374374
/// that circumstance (not when there is really a permissions error, for example). This is because
375375
/// neither channel monitor reading function lists updates. Instead, either reads the monitor, and
@@ -381,7 +381,7 @@ where
381381
/// Stale updates are pruned when the consolidation threshold is reached according to `maximum_pending_updates`.
382382
/// Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates`
383383
/// are deleted.
384-
/// The `lazy` flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions
384+
/// The `lazy` flag is used on the [`KVStoreSync::remove`] method, so there are no guarantees that the deletions
385385
/// will complete. However, stale updates are not a problem for data integrity, since updates are
386386
/// only read that are higher than the stored [`ChannelMonitor`]'s `update_id`.
387387
///
@@ -390,7 +390,7 @@ where
390390
/// [`MonitorUpdatingPersister::cleanup_stale_updates`] function.
391391
pub struct MonitorUpdatingPersister<K: Deref, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref>
392392
where
393-
K::Target: KVStore,
393+
K::Target: KVStoreSync,
394394
L::Target: Logger,
395395
ES::Target: EntropySource + Sized,
396396
SP::Target: SignerProvider + Sized,
@@ -410,7 +410,7 @@ where
410410
impl<K: Deref, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref>
411411
MonitorUpdatingPersister<K, L, ES, SP, BI, FE>
412412
where
413-
K::Target: KVStore,
413+
K::Target: KVStoreSync,
414414
L::Target: Logger,
415415
ES::Target: EntropySource + Sized,
416416
SP::Target: SignerProvider + Sized,
@@ -450,7 +450,7 @@ where
450450

451451
/// Reads all stored channel monitors, along with any stored updates for them.
452452
///
453-
/// It is extremely important that your [`KVStore::read`] implementation uses the
453+
/// It is extremely important that your [`KVStoreSync::read`] implementation uses the
454454
/// [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the
455455
/// documentation for [`MonitorUpdatingPersister`].
456456
pub fn read_all_channel_monitors_with_updates(
@@ -472,7 +472,7 @@ where
472472

473473
/// Read a single channel monitor, along with any stored updates for it.
474474
///
475-
/// It is extremely important that your [`KVStore::read`] implementation uses the
475+
/// It is extremely important that your [`KVStoreSync::read`] implementation uses the
476476
/// [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the
477477
/// documentation for [`MonitorUpdatingPersister`].
478478
///
@@ -599,7 +599,7 @@ where
599599
/// This function works by first listing all monitors, and then for each of them, listing all
600600
/// updates. The updates that have an `update_id` less than or equal to than the stored monitor
601601
/// are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will
602-
/// be passed to [`KVStore::remove`].
602+
/// be passed to [`KVStoreSync::remove`].
603603
pub fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), io::Error> {
604604
let monitor_keys = self.kv_store.list(
605605
CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
@@ -638,15 +638,15 @@ impl<
638638
FE: Deref,
639639
> Persist<ChannelSigner> for MonitorUpdatingPersister<K, L, ES, SP, BI, FE>
640640
where
641-
K::Target: KVStore,
641+
K::Target: KVStoreSync,
642642
L::Target: Logger,
643643
ES::Target: EntropySource + Sized,
644644
SP::Target: SignerProvider + Sized,
645645
BI::Target: BroadcasterInterface,
646646
FE::Target: FeeEstimator,
647647
{
648648
/// Persists a new channel. This means writing the entire monitor to the
649-
/// parametrized [`KVStore`].
649+
/// parametrized [`KVStoreSync`].
650650
fn persist_new_channel(
651651
&self, monitor_name: MonitorName, monitor: &ChannelMonitor<ChannelSigner>,
652652
) -> chain::ChannelMonitorUpdateStatus {
@@ -679,11 +679,11 @@ where
679679
}
680680
}
681681

682-
/// Persists a channel update, writing only the update to the parameterized [`KVStore`] if possible.
682+
/// Persists a channel update, writing only the update to the parameterized [`KVStoreSync`] if possible.
683683
///
684684
/// In some cases, this will forward to [`MonitorUpdatingPersister::persist_new_channel`]:
685685
///
686-
/// - No full monitor is found in [`KVStore`]
686+
/// - No full monitor is found in [`KVStoreSync`]
687687
/// - The number of pending updates exceeds `maximum_pending_updates` as given to [`Self::new`]
688688
/// - LDK commands re-persisting the entire monitor through this function, specifically when
689689
/// `update` is `None`.
@@ -793,7 +793,7 @@ impl<K: Deref, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref>
793793
MonitorUpdatingPersister<K, L, ES, SP, BI, FE>
794794
where
795795
ES::Target: EntropySource + Sized,
796-
K::Target: KVStore,
796+
K::Target: KVStoreSync,
797797
L::Target: Logger,
798798
SP::Target: SignerProvider + Sized,
799799
BI::Target: BroadcasterInterface,
@@ -874,7 +874,7 @@ pub enum MonitorName {
874874
}
875875

876876
impl MonitorName {
877-
/// Attempts to construct a `MonitorName` from a storage key returned by [`KVStore::list`].
877+
/// Attempts to construct a `MonitorName` from a storage key returned by [`KVStoreSync::list`].
878878
///
879879
/// This is useful when you need to reconstruct the original data the key represents.
880880
fn from_str(monitor_key: &str) -> Result<Self, io::Error> {
@@ -1413,7 +1413,7 @@ mod tests {
14131413

14141414
#[test]
14151415
fn kvstore_trait_object_usage() {
1416-
let store: Arc<dyn KVStore + Send + Sync> = Arc::new(TestStore::new(false));
1416+
let store: Arc<dyn KVStoreSync + Send + Sync> = Arc::new(TestStore::new(false));
14171417
assert!(persist_fn::<_, TestChannelSigner>(Arc::clone(&store)));
14181418
}
14191419
}

0 commit comments

Comments
 (0)