docs: document Options in get_highest_* and ensure_invariants (#9529)

This commit is contained in:
Dan Cline
2024-07-15 16:46:38 -04:00
committed by GitHub
parent 466885a8b2
commit f7a3864300

View File

@@ -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>,
@@ -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()