@@ -39,28 +39,28 @@ pub const KVSTORE_NAMESPACE_KEY_MAX_LEN: usize = 120;
39
39
40
40
/// The namespace under which the [`ChannelManager`] will be persisted.
41
41
pub const CHANNEL_MANAGER_PERSISTENCE_NAMESPACE : & str = "" ;
42
- /// The sub -namespace under which the [`ChannelManager`] will be persisted.
42
+ /// The secondary -namespace under which the [`ChannelManager`] will be persisted.
43
43
pub const CHANNEL_MANAGER_PERSISTENCE_SUB_NAMESPACE : & str = "" ;
44
44
/// The key under which the [`ChannelManager`] will be persisted.
45
45
pub const CHANNEL_MANAGER_PERSISTENCE_KEY : & str = "manager" ;
46
46
47
47
/// The namespace under which [`ChannelMonitor`]s will be persisted.
48
48
pub const CHANNEL_MONITOR_PERSISTENCE_NAMESPACE : & str = "monitors" ;
49
- /// The sub -namespace under which [`ChannelMonitor`]s will be persisted.
49
+ /// The secondary -namespace under which [`ChannelMonitor`]s will be persisted.
50
50
pub const CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE : & str = "" ;
51
51
/// The namespace under which [`ChannelMonitorUpdate`]s will be persisted.
52
52
pub const CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE : & str = "monitor_updates" ;
53
53
54
54
/// The namespace under which the [`NetworkGraph`] will be persisted.
55
55
pub const NETWORK_GRAPH_PERSISTENCE_NAMESPACE : & str = "" ;
56
- /// The sub -namespace under which the [`NetworkGraph`] will be persisted.
56
+ /// The secondary -namespace under which the [`NetworkGraph`] will be persisted.
57
57
pub const NETWORK_GRAPH_PERSISTENCE_SUB_NAMESPACE : & str = "" ;
58
58
/// The key under which the [`NetworkGraph`] will be persisted.
59
59
pub const NETWORK_GRAPH_PERSISTENCE_KEY : & str = "network_graph" ;
60
60
61
61
/// The namespace under which the [`WriteableScore`] will be persisted.
62
62
pub const SCORER_PERSISTENCE_NAMESPACE : & str = "" ;
63
- /// The sub -namespace under which the [`WriteableScore`] will be persisted.
63
+ /// The secondary -namespace under which the [`WriteableScore`] will be persisted.
64
64
pub const SCORER_PERSISTENCE_SUB_NAMESPACE : & str = "" ;
65
65
/// The key under which the [`WriteableScore`] will be persisted.
66
66
pub const SCORER_PERSISTENCE_KEY : & str = "scorer" ;
@@ -75,35 +75,37 @@ pub const MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL: &[u8] = &[0xFF; 2];
75
75
/// with given keys.
76
76
///
77
77
/// In order to avoid collisions the key space is segmented based on the given `primary_namespace`s
78
- /// and `sub_namespace `s. Implementations of this trait are free to handle them in different ways,
79
- /// as long as per-namespace key uniqueness is asserted.
78
+ /// and `secondary_namespace `s. Implementations of this trait are free to handle them in different
79
+ /// ways, as long as per-namespace key uniqueness is asserted.
80
80
///
81
81
/// Keys and namespaces are required to be valid ASCII strings in the range of
82
82
/// [`KVSTORE_NAMESPACE_KEY_ALPHABET`] and no longer than [`KVSTORE_NAMESPACE_KEY_MAX_LEN`]. Empty
83
- /// primary namespaces and sub-namespaces (`""`) are assumed to be a valid, however, if
84
- /// `primary_namespace` is empty, `sub_namespace` is required to be empty, too. This means that
85
- /// concerns should always be separated by primary namespace first, before sub-namespaces are used.
86
- /// While the number of primary namespaces will be relatively small and is determined at compile
87
- /// time, there may be many sub-namespaces per primary namespace. Note that per-namespace
88
- /// uniqueness needs to also hold for keys *and* namespaces in any given namespace, i.e., conflicts
89
- /// between keys and equally named primary-namespaces/sub-namespaces must be avoided.
83
+ /// primary namespaces and secondary-namespaces (`""`) are assumed to be a valid, however, if
84
+ /// `primary_namespace` is empty, `secondary_namespace` is required to be empty, too. This means
85
+ /// that concerns should always be separated by primary namespace first, before secondary
86
+ /// namespaces are used. While the number of primary namespaces will be relatively small and is
87
+ /// determined at compile time, there may be many secondary namespaces per primary namespace. Note
88
+ /// that per-namespace uniqueness needs to also hold for keys *and* namespaces in any given
89
+ /// namespace, i.e., conflicts between keys and equally named
90
+ /// primary-namespaces/secondary-namespaces must be avoided.
90
91
///
91
92
/// **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister`
92
- /// interface can use a concatenation of `[{primary_namespace}/[{sub_namespace }/]]{key}` to recover
93
- /// a `key` compatible with the data model previously assumed by `KVStorePersister::persist`.
93
+ /// interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace }/]]{key}` to
94
+ /// recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`.
94
95
pub trait KVStore {
95
- /// Returns the data stored for the given `primary_namespace`, `sub_namespace`, and `key`.
96
+ /// Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and
97
+ /// `key`.
96
98
///
97
99
/// Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given
98
- /// `primary_namespace` and `sub_namespace `.
100
+ /// `primary_namespace` and `secondary_namespace `.
99
101
///
100
102
/// [`ErrorKind::NotFound`]: io::ErrorKind::NotFound
101
- fn read ( & self , primary_namespace : & str , sub_namespace : & str , key : & str ) -> Result < Vec < u8 > , io:: Error > ;
103
+ fn read ( & self , primary_namespace : & str , secondary_namespace : & str , key : & str ) -> Result < Vec < u8 > , io:: Error > ;
102
104
/// Persists the given data under the given `key`.
103
105
///
104
- /// Will create the given `primary_namespace` and `sub_namespace ` if not already present in the
106
+ /// Will create the given `primary_namespace` and `secondary_namespace ` if not already present in the
105
107
/// store.
106
- fn write ( & self , primary_namespace : & str , sub_namespace : & str , key : & str , buf : & [ u8 ] ) -> Result < ( ) , io:: Error > ;
108
+ fn write ( & self , primary_namespace : & str , secondary_namespace : & str , key : & str , buf : & [ u8 ] ) -> Result < ( ) , io:: Error > ;
107
109
/// Removes any data that had previously been persisted under the given `key`.
108
110
///
109
111
/// If the `lazy` flag is set to `true`, the backend implementation might choose to lazily
@@ -117,15 +119,15 @@ pub trait KVStore {
117
119
/// set for `remove` operations that can be safely replayed at a later time.
118
120
///
119
121
/// Returns successfully if no data will be stored for the given `primary_namespace`,
120
- /// `sub_namespace `, and `key`, independently of whether it was present before its invokation
121
- /// or not.
122
- fn remove ( & self , primary_namespace : & str , sub_namespace : & str , key : & str , lazy : bool ) -> Result < ( ) , io:: Error > ;
123
- /// Returns a list of keys that are stored under the given `sub_namespace ` in
122
+ /// `secondary_namespace `, and `key`, independently of whether it was present before its
123
+ /// invokation or not.
124
+ fn remove ( & self , primary_namespace : & str , secondary_namespace : & str , key : & str , lazy : bool ) -> Result < ( ) , io:: Error > ;
125
+ /// Returns a list of keys that are stored under the given `secondary_namespace ` in
124
126
/// `primary_namespace`.
125
127
///
126
128
/// Returns the keys in arbitrary order, so users requiring a particular order need to sort the
127
- /// returned keys. Returns an empty list if `primary_namespace` or `sub_namespace ` is unknown.
128
- fn list ( & self , primary_namespace : & str , sub_namespace : & str ) -> Result < Vec < String > , io:: Error > ;
129
+ /// returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace ` is unknown.
130
+ fn list ( & self , primary_namespace : & str , secondary_namespace : & str ) -> Result < Vec < String > , io:: Error > ;
129
131
}
130
132
131
133
/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
@@ -300,12 +302,12 @@ where
300
302
/// Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_NAMESPACE`], using the
301
303
/// familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`).
302
304
///
303
- /// Each [`ChannelMonitorUpdate`] is stored in a dynamic sub- namespace, as follows:
305
+ /// Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows:
304
306
///
305
- /// - primary- namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE`]
306
- /// - sub- namespace: [the monitor's encoded outpoint name]
307
+ /// - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE`]
308
+ /// - secondary namespace: [the monitor's encoded outpoint name]
307
309
///
308
- /// Under that sub- namespace, each update is stored with a number string, like `21`, which
310
+ /// Under that secondary namespace, each update is stored with a number string, like `21`, which
309
311
/// represents its `update_id` value.
310
312
///
311
313
/// For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]:
@@ -317,7 +319,7 @@ where
317
319
///
318
320
/// `[CHANNEL_MONITOR_PERSISTENCE_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1`
319
321
///
320
- /// Updates would be stored as follows (with `/` delimiting primary-namespace/sub-namespace /key):
322
+ /// Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace /key):
321
323
///
322
324
/// ```text
323
325
/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1
0 commit comments