-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: search for a snapshot that fulfills a queried BlockHash
or TxHash
#5373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Co-authored-by: Matthias Seitz <[email protected]>
// Otherwise, check `self.available_snapshots` | ||
let snapshot_ranges = match path { | ||
Some(path) => SnapshotSegment::parse_filename( | ||
path.file_name().ok_or_else(|| ProviderError::MissingSnapshot)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.file_name().ok_or_else(|| ProviderError::MissingSnapshot)?, | |
path.file_name().ok_or_else(|| ProviderError::MissingSnapshot(segment, path))?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ended up creating more variants
|
||
while let Some((block_end, tx_range)) = snapshots_rev_iter.next() { | ||
let block_start = | ||
snapshots_rev_iter.peek().map(|(block_end, _)| *block_end + 1).unwrap_or(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a comment here why it's correct to do unwrap_or(0)
and always return a range on latest snapshot?
PR into #5287
There are some changes to accomplish what the title says.
BlockNumber -> Range<TxNumber>
&TxNumber -> Range<BlockNumber>
), where each key is the end number of a snapshot segment.SnapshotProvider
is created and read from disk. This enables handling custom range snapshots instead of being tied to the default one.get_segment_provider_from_transaction
andget_segment_provider_from_block
SnapshotProvider::find_snapshot
. This will iterate all existing snapshots (loading them from disk into the dashmap,) until we find one that returnsSome(T)
. Example:SnapshotsProvider