Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove tx_range from filename #5823

Merged
merged 9 commits into from
Jan 2, 2024
Merged

Conversation

joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Dec 18, 2023

  • removes tx_range from filename
  • use SegmentHeader ranges as source of truth
  • use find_fixed_range when dealing with filenames or find out if new insertion is past the expected range

@joshieDo joshieDo changed the base branch from main to joshie/tx-snap-sync December 18, 2023 17:15
@joshieDo joshieDo changed the title Joshie/rm tx range feat: remove tx_range from filename Dec 18, 2023
pub fn tx_range(&self) -> &RangeInclusive<TxNumber> {
&self.tx_range
pub fn tx_range(&self) -> Option<RangeInclusive<TxNumber>> {
self.tx_range.as_ref().map(|range| range.clone())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.tx_range.as_ref().map(|range| range.clone())
self.tx_range.clone()

@@ -195,44 +180,63 @@ impl SegmentHeader {

/// Returns the first transaction number of the segment.
pub fn tx_start(&self) -> TxNumber {
*self.tx_range.start()
*self.tx_range.as_ref().expect("should exist").start()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may not exist for the Headers segment

@@ -43,7 +45,7 @@ pub struct SnapshotProvider {
/// segments and ranges.
map: DashMap<(BlockNumber, SnapshotSegment), LoadedJar>,
/// Available snapshot transaction ranges on disk indexed by max blocks.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a new comment

Comment on lines 191 to 197
.filter_map(|max| {
if **max >= block {
return Some(find_fixed_range(BLOCKS_PER_SNAPSHOT, block))
}
None
})
.next()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find()

@joshieDo joshieDo marked this pull request as ready for review January 2, 2024 23:17
@joshieDo joshieDo merged commit 5be02b8 into joshie/tx-snap-sync Jan 2, 2024
23 checks passed
@joshieDo joshieDo deleted the joshie/rm-tx-range branch January 2, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants