mirror of
https://github.com/vacp2p/pmtree.git
synced 2025-02-17 17:56:26 +00:00
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<()> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,14 @@ impl Database for MySled {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn put_batch(&mut self, subtree: HashMap<DBKey, Value>) -> Result<()> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user