test: implement batch_insertions for sled

This commit is contained in:
Magamedrasul Ibragimov 2023-02-02 16:11:50 +04:00
parent 0d3f2e0657
commit f7e19730f8
2 changed files with 16 additions and 0 deletions

View File

@ -103,6 +103,14 @@ impl Database for MySled {
}
fn put_batch(&mut self, subtree: HashMap<DBKey, Value>) -> Result<()> {
let mut batch = sled::Batch::default();
for (key, value) in subtree {
batch.insert(&key, value);
}
self.0.apply_batch(batch).unwrap();
Ok(())
}
}

View File

@ -41,6 +41,14 @@ impl Database for MySled {
}
fn put_batch(&mut self, subtree: HashMap<DBKey, Value>) -> Result<()> {
let mut batch = sled::Batch::default();
for (key, value) in subtree {
batch.insert(&key, value);
}
self.0.apply_batch(batch).unwrap();
Ok(())
}
}