Skip to content

Commit b165838

Browse files
committed
Update KVStore in test_utils with AsyncResult
1 parent a5bec01 commit b165838

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lightning/src/util/test_utils.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ use crate::sign::{self, ReceiveAuthKey};
5050
use crate::sign::{ChannelSigner, PeerStorageKey};
5151
use crate::sync::RwLock;
5252
use crate::types::features::{ChannelFeatures, InitFeatures, NodeFeatures};
53+
use crate::util::async_poll::AsyncResult;
5354
use crate::util::config::UserConfig;
5455
use crate::util::dyn_signer::{
5556
DynKeysInterface, DynKeysInterfaceTrait, DynPhantomKeysInterface, DynSigner,
@@ -1011,13 +1012,13 @@ impl TestStore {
10111012
impl KVStore for TestStore {
10121013
fn read(
10131014
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
1014-
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, io::Error>> + 'static + Send>> {
1015+
) -> AsyncResult<'static, Vec<u8>, io::Error> {
10151016
let res = self.read_internal(&primary_namespace, &secondary_namespace, &key);
10161017
Box::pin(async move { res })
10171018
}
10181019
fn write(
10191020
&self, primary_namespace: &str, secondary_namespace: &str, key: &str, buf: Vec<u8>,
1020-
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + 'static + Send>> {
1021+
) -> AsyncResult<'static, (), io::Error> {
10211022
let path = format!("{primary_namespace}/{secondary_namespace}/{key}");
10221023
let future = Arc::new(Mutex::new((None, None)));
10231024

@@ -1030,13 +1031,13 @@ impl KVStore for TestStore {
10301031
}
10311032
fn remove(
10321033
&self, primary_namespace: &str, secondary_namespace: &str, key: &str,
1033-
) -> Pin<Box<dyn Future<Output = Result<(), io::Error>> + 'static + Send>> {
1034+
) -> AsyncResult<'static, (), io::Error> {
10341035
let res = self.remove_internal(&primary_namespace, &secondary_namespace, &key);
10351036
Box::pin(async move { res })
10361037
}
10371038
fn list(
10381039
&self, primary_namespace: &str, secondary_namespace: &str,
1039-
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, io::Error>> + 'static + Send>> {
1040+
) -> AsyncResult<'static, Vec<String>, io::Error> {
10401041
let res = self.list_internal(primary_namespace, secondary_namespace);
10411042
Box::pin(async move { res })
10421043
}

0 commit comments

Comments
 (0)