From 2d4aaa7db96321ef12e21936b2d64de17708e54b Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:14:26 -0400 Subject: [PATCH] docs: document Options in get_highest_* and ensure_invariants I was using the `get_highest_*` methods and noticed that they did not explain the exact meaning of `Some` or `None` in docs. This is now explained, along with more docs for `ensure_invariants`. --- .../provider/src/providers/static_file/manager.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/storage/provider/src/providers/static_file/manager.rs b/crates/storage/provider/src/providers/static_file/manager.rs index 19d6b06843d7..548b395d74ea 100644 --- a/crates/storage/provider/src/providers/static_file/manager.rs +++ b/crates/storage/provider/src/providers/static_file/manager.rs @@ -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>( &self, provider: &DatabaseProvider, @@ -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 { 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 { self.static_files_tx_index .read()