Skip to content

Commit 91ae8b8

Browse files
committed
Define MigratableKVStore trait with list_all_keys method
.. which will be used for generic `KVStore`-to-`KVStore` migration logic.
1 parent fe1cf69 commit 91ae8b8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lightning/src/util/persist.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ pub trait KVStore {
163163
) -> Result<Vec<String>, io::Error>;
164164
}
165165

166+
/// Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`]
167+
/// data migration.
168+
pub trait MigratableKVStore: KVStore {
169+
/// Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples.
170+
///
171+
/// This is useful for migrating data from [`KVStore`] implementation to [`KVStore`]
172+
/// implementation.
173+
///
174+
/// Must exhaustively return all entries known to the store to ensure no data is missed, but
175+
/// may return the items in arbitrary order.
176+
fn list_all_keys(&self) -> Result<Vec<(String, String, String)>, io::Error>;
177+
}
178+
166179
/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
167180
///
168181
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager

0 commit comments

Comments
 (0)