Skip to content

Commit

Permalink
Fix Store iteration bug
Browse files Browse the repository at this point in the history
The previous code was only correctly iterating over a single block,
ignoring any others.
  • Loading branch information
hannobraun committed Nov 23, 2022
1 parent d44b6b0 commit 12f0c11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/fj-kernel/src/storage/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ impl Index {
self.object_index.0 += 1;
if self.object_index.0 >= block.len() {
self.block_index.0 += 1;
self.object_index.0 = 0;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/fj-kernel/src/storage/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ mod tests {

#[test]
fn insert_and_handle() {
let store = Store::new();
let store = Store::with_block_size(1);

let object = 0;
let handle = store.insert(object);
Expand All @@ -191,7 +191,7 @@ mod tests {

#[test]
fn insert_and_iter() {
let store = Store::new();
let store = Store::with_block_size(1);

let a = store.insert(0);
let b = store.insert(1);
Expand Down

0 comments on commit 12f0c11

Please sign in to comment.