mirror of
https://github.com/vacp2p/pmtree.git
synced 2026-01-09 15:28:02 -05:00
test: implement batch_insertions for sled
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user