Skip to content

Commit aa90767

Browse files
committed
f Update TestSyncStore
1 parent bb918bc commit aa90767

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

lightning-persister/src/test_utils.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ impl TestSyncStore {
142142
}
143143

144144
impl KVStore for TestSyncStore {
145-
fn read(&self, namespace: &str, key: &str) -> std::io::Result<Vec<u8>> {
146-
let fs_res = self.fs_store.read(namespace, key);
147-
let sqlite_res = self.sqlite_store.read(namespace, key);
148-
let test_res = self.test_store.read(namespace, key);
145+
fn read(&self, namespace: &str, sub_namespace: &str, key: &str) -> std::io::Result<Vec<u8>> {
146+
let fs_res = self.fs_store.read(namespace, sub_namespace, key);
147+
let sqlite_res = self.sqlite_store.read(namespace, sub_namespace, key);
148+
let test_res = self.test_store.read(namespace, sub_namespace, key);
149149

150150
match fs_res {
151151
Ok(read) => {
@@ -163,12 +163,12 @@ impl KVStore for TestSyncStore {
163163
}
164164
}
165165

166-
fn write(&self, namespace: &str, key: &str, buf: &[u8]) -> std::io::Result<()> {
167-
let fs_res = self.fs_store.write(namespace, key, buf);
168-
let sqlite_res = self.sqlite_store.write(namespace, key, buf);
169-
let test_res = self.test_store.write(namespace, key, buf);
166+
fn write(&self, namespace: &str, sub_namespace: &str, key: &str, buf: &[u8]) -> std::io::Result<()> {
167+
let fs_res = self.fs_store.write(namespace, sub_namespace, key, buf);
168+
let sqlite_res = self.sqlite_store.write(namespace, sub_namespace, key, buf);
169+
let test_res = self.test_store.write(namespace, sub_namespace, key, buf);
170170

171-
assert!(self.list(namespace).unwrap().contains(&key.to_string()));
171+
assert!(self.list(namespace, sub_namespace).unwrap().contains(&key.to_string()));
172172

173173
match fs_res {
174174
Ok(()) => {
@@ -184,12 +184,12 @@ impl KVStore for TestSyncStore {
184184
}
185185
}
186186

187-
fn remove(&self, namespace: &str, key: &str) -> std::io::Result<()> {
188-
let fs_res = self.fs_store.remove(namespace, key);
189-
let sqlite_res = self.sqlite_store.remove(namespace, key);
190-
let test_res = self.test_store.remove(namespace, key);
187+
fn remove(&self, namespace: &str, sub_namespace: &str, key: &str, lazy: bool) -> std::io::Result<()> {
188+
let fs_res = self.fs_store.remove(namespace, sub_namespace, key, lazy);
189+
let sqlite_res = self.sqlite_store.remove(namespace, sub_namespace, key, lazy);
190+
let test_res = self.test_store.remove(namespace, sub_namespace, key, lazy);
191191

192-
assert!(!self.list(namespace).unwrap().contains(&key.to_string()));
192+
assert!(!self.list(namespace, sub_namespace).unwrap().contains(&key.to_string()));
193193

194194
match fs_res {
195195
Ok(()) => {
@@ -205,10 +205,10 @@ impl KVStore for TestSyncStore {
205205
}
206206
}
207207

208-
fn list(&self, namespace: &str) -> std::io::Result<Vec<String>> {
209-
let fs_res = self.fs_store.list(namespace);
210-
let sqlite_res = self.sqlite_store.list(namespace);
211-
let test_res = self.test_store.list(namespace);
208+
fn list(&self, namespace: &str, sub_namespace: &str) -> std::io::Result<Vec<String>> {
209+
let fs_res = self.fs_store.list(namespace, sub_namespace);
210+
let sqlite_res = self.sqlite_store.list(namespace, sub_namespace);
211+
let test_res = self.test_store.list(namespace, sub_namespace);
212212

213213
match fs_res {
214214
Ok(mut list) => {

0 commit comments

Comments
 (0)