Skip to content

Commit 24be993

Browse files
committed
f make Matt's life easier with respect to #2595
1 parent 0a8cd49 commit 24be993

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lightning/src/util/persist.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ pub trait KVStore {
9898
/// `namespace` and `sub_namespace`.
9999
///
100100
/// [`ErrorKind::NotFound`]: io::ErrorKind::NotFound
101-
fn read(&self, namespace: &str, sub_namespace: &str, key: &str) -> io::Result<Vec<u8>>;
101+
fn read(&self, namespace: &str, sub_namespace: &str, key: &str) -> Result<Vec<u8>, io::Error>;
102102
/// Persists the given data under the given `key`.
103103
///
104104
/// Will create the given `namespace` and `sub_namespace` if not already present in the store.
105-
fn write(&self, namespace: &str, sub_namespace: &str, key: &str, buf: &[u8]) -> io::Result<()>;
105+
fn write(&self, namespace: &str, sub_namespace: &str, key: &str, buf: &[u8]) -> Result<(), io::Error>;
106106
/// Removes any data that had previously been persisted under the given `key`.
107107
///
108108
/// If the `lazy` flag is set to `true`, the backend implementation might choose to lazily
@@ -117,12 +117,12 @@ pub trait KVStore {
117117
///
118118
/// Returns successfully if no data will be stored for the given `namespace`, `sub_namespace`, and
119119
/// `key`, independently of whether it was present before its invokation or not.
120-
fn remove(&self, namespace: &str, sub_namespace: &str, key: &str, lazy: bool) -> io::Result<()>;
120+
fn remove(&self, namespace: &str, sub_namespace: &str, key: &str, lazy: bool) -> Result<(), io::Error>;
121121
/// Returns a list of keys that are stored under the given `sub_namespace` in `namespace`.
122122
///
123123
/// Returns the keys in arbitrary order, so users requiring a particular order need to sort the
124124
/// returned keys. Returns an empty list if `namespace` or `sub_namespace` is unknown.
125-
fn list(&self, namespace: &str, sub_namespace: &str) -> io::Result<Vec<String>>;
125+
fn list(&self, namespace: &str, sub_namespace: &str) -> Result<Vec<String>, io::Error>;
126126
}
127127

128128
/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
@@ -216,7 +216,7 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner, K: KVStore> Persist<ChannelSign
216216
/// Read previously persisted [`ChannelMonitor`]s from the store.
217217
pub fn read_channel_monitors<K: Deref, ES: Deref, SP: Deref>(
218218
kv_store: K, entropy_source: ES, signer_provider: SP,
219-
) -> io::Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>>
219+
) -> Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>, io::Error>
220220
where
221221
K::Target: KVStore,
222222
ES::Target: EntropySource + Sized,
@@ -403,7 +403,7 @@ where
403403
/// documentation for [`MonitorUpdatingPersister`].
404404
pub fn read_all_channel_monitors_with_updates<B: Deref, F: Deref + Clone>(
405405
&self, broadcaster: B, fee_estimator: F,
406-
) -> io::Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>>
406+
) -> Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>, io::Error>
407407
where
408408
ES::Target: EntropySource + Sized,
409409
SP::Target: SignerProvider + Sized,
@@ -435,7 +435,7 @@ where
435435
/// function to accomplish this. Take care to limit the number of parallel readers.
436436
pub fn read_channel_monitor_with_updates<B: Deref, F: Deref + Clone>(
437437
&self, broadcaster: B, fee_estimator: F, monitor_key: String,
438-
) -> io::Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>
438+
) -> Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>), io::Error>
439439
where
440440
ES::Target: EntropySource + Sized,
441441
SP::Target: SignerProvider + Sized,
@@ -478,7 +478,7 @@ where
478478
/// Read a channel monitor.
479479
fn read_monitor(
480480
&self, monitor_name: &MonitorName,
481-
) -> io::Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)> {
481+
) -> Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>), io::Error> {
482482
let outpoint: OutPoint = monitor_name.try_into()?;
483483
let mut monitor_cursor = io::Cursor::new(self.kv_store.read(
484484
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
@@ -525,7 +525,7 @@ where
525525
/// Read a channel monitor update.
526526
fn read_monitor_update(
527527
&self, monitor_name: &MonitorName, update_name: &UpdateName,
528-
) -> io::Result<ChannelMonitorUpdate> {
528+
) -> Result<ChannelMonitorUpdate, io::Error> {
529529
let update_bytes = self.kv_store.read(
530530
CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
531531
monitor_name.as_str(),
@@ -550,7 +550,7 @@ where
550550
/// updates. The updates that have an `update_id` less than or equal to than the stored monitor
551551
/// are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will
552552
/// be passed to [`KVStore::remove`].
553-
pub fn cleanup_stale_updates(&self, lazy: bool) -> io::Result<()> {
553+
pub fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), io::Error> {
554554
let monitor_keys = self.kv_store.list(
555555
CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
556556
CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,

0 commit comments

Comments
 (0)