mirror of https://github.com/vacp2p/pmtree.git
test: implement batch_insertions for sled
This commit is contained in:
parent
0d3f2e0657
commit
f7e19730f8
|
@ -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(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue