Skip to content

Commit

Permalink
Add assertion to catch misimplemented fixed width types
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Sep 30, 2023
1 parent 13604b5 commit 51af049
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tree_store/btree_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ impl<'a> RawLeafBuilder<'a> {
}

pub(crate) fn append(&mut self, key: &[u8], value: &[u8]) {
if let Some(key_width) = self.fixed_key_size {
assert_eq!(key_width, key.len());
}
if let Some(value_width) = self.fixed_value_size {
assert_eq!(value_width, value.len());
}
let key_offset = if self.pairs_written == 0 {
self.key_section_start()
} else {
Expand Down

0 comments on commit 51af049

Please sign in to comment.