Skip to content

Commit

Permalink
docs: document Options in get_highest_* and ensure_invariants (paradi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Jul 15, 2024
1 parent 466885a commit f7a3864
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit f7a3864

Please sign in to comment.