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

docs: document Options in get_highest_* and ensure_invariants #9529

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions crates/storage/provider/src/providers/static_file/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,13 @@ impl StaticFileProvider {
/// * its highest block should match the stage checkpoint block number if it's equal or higher
/// than the corresponding database table last entry.
/// * If the checkpoint block is higher, then request a pipeline unwind to the static file
/// block.
/// * If the checkpoint block is lower, then heal by removing rows from the static file.
/// block. This is expressed by returning [`Some`] with the requested pipeline unwind
/// target.
/// * If the checkpoint block is lower, then heal by removing rows from the static file. In
/// this case, the rows will be removed and [`None`] will be returned.
///
/// * If the database tables overlap with static files and have contiguous keys, or the
/// checkpoint block matches the highest static files block, then [`None`] will be returned.
fn ensure_invariants<TX: DbTx, T: Table<Key = u64>>(
&self,
provider: &DatabaseProvider<TX>,
Expand Down Expand Up @@ -736,11 +741,15 @@ impl StaticFileProvider {
}

/// Gets the highest static file block if it exists for a static file segment.
///
/// If there is nothing on disk for the given segment, this will return [`None`].
pub fn get_highest_static_file_block(&self, segment: StaticFileSegment) -> Option<BlockNumber> {
self.static_files_max_block.read().get(&segment).copied()
}

/// Gets the highest static file transaction.
///
/// If there is nothing on disk for the given segment, this will return [`None`].
pub fn get_highest_static_file_tx(&self, segment: StaticFileSegment) -> Option<TxNumber> {
self.static_files_tx_index
.read()
Expand Down
Loading