Skip to content

Commit

Permalink
unify block_range and tx_range api on segment header
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed Jan 17, 2024
1 parent 0bc9b91 commit dd749fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/primitives/src/snapshot/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl SegmentHeader {

/// Returns the block range.
pub fn block_range(&self) -> RangeInclusive<BlockNumber> {
&self.block_range
self.block_range.clone()
}

/// Returns the transaction range.
Expand Down
3 changes: 1 addition & 2 deletions crates/storage/db/src/snapshot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ pub fn iter_snapshots(path: impl AsRef<Path>) -> Result<SortedSnapshots, NippyJa
{
let jar = NippyJar::<SegmentHeader>::load(&entry.path())?;

let ranges =
(jar.user_header().block_range().clone(), jar.user_header().tx_range());
let ranges = (jar.user_header().block_range(), jar.user_header().tx_range());

match static_files.entry(segment) {
Entry::Occupied(mut entry) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/snapshot/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl SnapshotProvider {

// Current block range has the same block start as `fixed_range``, but block end
// might be different if we are still filling this static file.
let current_block_range = jar.user_header().block_range().clone();
let current_block_range = jar.user_header().block_range();

// Considering that `update_index` is called when we either append/truncate, we
// are sure that we are handling the latest data points.
Expand Down

0 comments on commit dd749fc

Please sign in to comment.