Skip to content

Commit fc1e87e

Browse files
committed
tunning len hints
1 parent a4ae307 commit fc1e87e

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vsdb_core"
3-
version = "6.0.0"
3+
version = "6.0.1"
44
authors = ["[email protected]"]
55
edition = "2024"
66
description = "A std-collection-like database"

core/src/common/engines/parity_backend.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,11 @@ impl Engine for ParityEngine {
268268
}
269269

270270
fn get_instance_len_hint(&self, instance_prefix: PreBytes) -> u64 {
271-
crate::parse_int!(
272-
self.hdr.get(META_COLID, &instance_prefix).unwrap().unwrap(),
273-
u64
274-
)
271+
self.hdr
272+
.get(META_COLID, &instance_prefix)
273+
.unwrap()
274+
.map(|v| crate::parse_int!(v, u64))
275+
.unwrap_or(0)
275276
}
276277

277278
fn set_instance_len_hint(&self, instance_prefix: PreBytes, new_len: u64) {

core/src/common/engines/rocks_backend.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ impl Engine for RocksEngine {
258258
}
259259

260260
fn get_instance_len_hint(&self, instance_prefix: PreBytes) -> u64 {
261-
crate::parse_int!(self.meta.get(instance_prefix).unwrap().unwrap(), u64)
261+
self.meta
262+
.get(instance_prefix)
263+
.unwrap()
264+
.map(|v| crate::parse_int!(v, u64))
265+
.unwrap_or(0)
262266
}
263267

264268
fn set_instance_len_hint(&self, instance_prefix: PreBytes, new_len: u64) {

0 commit comments

Comments
 (0)