Skip to content

Commit

Permalink
Add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Oct 30, 2023
1 parent 3998716 commit e584aa0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions downstairs/src/extent_inner_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,10 @@ impl RawLayout {
/// Write out the active context array and metadata section of the file
///
/// This is done in a single write, so it should be atomic.
///
/// # Panics
/// `active_context.len()` must match `self.block_count()`, and the function
/// will panic otherwise.
fn write_active_context_and_metadata(
&self,
file: &File,
Expand All @@ -1325,6 +1329,8 @@ impl RawLayout {
flush_number: u64,
gen_number: u64,
) -> Result<(), CrucibleError> {
assert_eq!(active_context.len(), self.block_count() as usize);

// Serialize bitpacked active slot values
let mut buf = self.buf.take();
buf.clear();
Expand Down

0 comments on commit e584aa0

Please sign in to comment.