Rename migratable KV store trait for sync API
What changed, and why it matters
This commit is a simple rename of a Rust programming interface (trait) from MigratableKVStore to MigratableKVStoreSync. It only changes names to make room for a future asynchronous version. No behavior, logic, or security properties of the code are changed.
No security action needed. Treat as a normal API naming refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch renames the trait MigratableKVStore to MigratableKVStoreSync and updates all references in four files: lightning/src/util/persist.rs (trait definition), lightning-persister/src/fs_store/v1.rs, lightning-persister/src/fs_store/v2.rs, and lightning-persister/src/test_utils.rs. The trait’s methods, bounds, and all call sites remain functionally identical. It is a pure refactor in preparation for an async variant.
Changed components
lightning/src/util/persist.rslightning-persister/src/fs_store/v1.rslightning-persister/src/fs_store/v2.rslightning-persister/src/test_utils.rsInspect captured patch +9 / −9
diff --git a/lightning-persister/src/fs_store/v1.rs b/lightning-persister/src/fs_store/v1.rs
index 7f47c59..4768b81 100644
--- a/lightning-persister/src/fs_store/v1.rs
+++ b/lightning-persister/src/fs_store/v1.rs
@@ -1,7 +1,7 @@
//! Objects related to [`FilesystemStore`] live here.
use crate::fs_store::common::FilesystemStoreState;
-use lightning::util::persist::{KVStoreSync, MigratableKVStore};
+use lightning::util::persist::{KVStoreSync, MigratableKVStoreSync};
use std::path::PathBuf;
@@ -88,7 +88,7 @@ impl KVStore for FilesystemStore {
}
}
-impl MigratableKVStore for FilesystemStore {
+impl MigratableKVStoreSync for FilesystemStore {
fn list_all_keys(&self) -> Result<Vec<(String, String, String)>, lightning::io::Error> {
self.state.list_all_keys_impl(false)
}
diff --git a/lightning-persister/src/fs_store/v2.rs b/lightning-persister/src/fs_store/v2.rs
index 6154d22..fd18e20 100644
--- a/lightning-persister/src/fs_store/v2.rs
+++ b/lightning-persister/src/fs_store/v2.rs
@@ -4,7 +4,7 @@ use crate::fs_store::common::{
};
use lightning::util::persist::{
- KVStoreSync, MigratableKVStore, PageToken, PaginatedKVStoreSync, PaginatedListResponse,
+ KVStoreSync, MigratableKVStoreSync, PageToken, PaginatedKVStoreSync, PaginatedListResponse,
};
use std::fs;
@@ -315,7 +315,7 @@ impl PaginatedKVStore for FilesystemStoreV2 {
}
}
-impl MigratableKVStore for FilesystemStoreV2 {
+impl MigratableKVStoreSync for FilesystemStoreV2 {
fn list_all_keys(&self) -> Result<Vec<(String, String, String)>, lightning::io::Error> {
self.inner.list_all_keys_impl(true)
}
diff --git a/lightning-persister/src/test_utils.rs b/lightning-persister/src/test_utils.rs
index b8f3eb0..115f251 100644
--- a/lightning-persister/src/test_utils.rs
+++ b/lightning-persister/src/test_utils.rs
@@ -1,7 +1,7 @@
use lightning::events::ClosureReason;
use lightning::ln::functional_test_utils::*;
use lightning::util::persist::{
- migrate_kv_store_data, read_channel_monitors, KVStoreSync, MigratableKVStore,
+ migrate_kv_store_data, read_channel_monitors, KVStoreSync, MigratableKVStoreSync,
KVSTORE_NAMESPACE_KEY_ALPHABET, KVSTORE_NAMESPACE_KEY_MAX_LEN,
};
use lightning::util::test_utils;
@@ -59,7 +59,7 @@ pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(
assert_eq!(listed_keys.len(), 0);
}
-pub(crate) fn do_test_data_migration<S: MigratableKVStore, T: MigratableKVStore>(
+pub(crate) fn do_test_data_migration<S: MigratableKVStoreSync, T: MigratableKVStoreSync>(
source_store: &mut S, target_store: &mut T,
) {
// We fill the source with some bogus keys.
diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs
index 95d6032..10e6df4 100644
--- a/lightning/src/util/persist.rs
+++ b/lightning/src/util/persist.rs
@@ -554,9 +554,9 @@ pub trait PaginatedKVStore: KVStore {
) -> impl Future<Output = Result<PaginatedListResponse, io::Error>> + 'static + MaybeSend;
}
-/// Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`]
+/// Provides additional interface methods that are required for [`KVStoreSync`]-to-[`KVStoreSync`]
/// data migration.
-pub trait MigratableKVStore: KVStoreSync {
+pub trait MigratableKVStoreSync: KVStoreSync {
/// Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples.
///
/// This is useful for migrating data from [`KVStoreSync`] implementation to [`KVStoreSync`]
@@ -575,7 +575,7 @@ pub trait MigratableKVStore: KVStoreSync {
///
/// Will abort and return an error if any IO operation fails. Note that in this case the
/// `target_store` might get left in an intermediate state.
-pub fn migrate_kv_store_data<S: MigratableKVStore, T: MigratableKVStore>(
+pub fn migrate_kv_store_data<S: MigratableKVStoreSync, T: MigratableKVStoreSync>(
source_store: &mut S, target_store: &mut T,
) -> Result<(), io::Error> {
let keys_to_migrate = source_store.list_all_keys()?;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.