Skip to content

Commit

Permalink
fix: fixing comments and var names
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Aug 5, 2024
1 parent 89fb31e commit d3b4978
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ public Optional<Block> read(final long blockNumber) throws IOException {

try {
// There may be thousands of BlockItem files in a Block directory.
// The BlockItems must be added to the Block object in order. A
// DirectoryStream will iterate without any guaranteed order. To avoid sorting,
// and to keep the retrieval process linear with the number of BlockItems,
// Run a loop to fetch in the order we need. The loop will break when
// it looks for a BlockItem file that does not exist.
// The BlockItems must be added to the outbound Block object in order.
// However, using something like DirectoryStream will iterate without
// any guaranteed order. To avoid sorting and to keep the retrieval
// process linear with the number of BlockItems in the Block, run a loop
// to fetch BlockItems in the expected order. For example, in a Block
// directory "1" containing 10 BlockItem files (1.blk, 2.blk, 3.blk, ...,
// 10.blk), the loop will directly fetch the BlockItems in order based on
// their file names. The loop will exit when it attempts to read a
// BlockItem file that does not exist (e.g., 11.blk).
final Builder builder = Block.newBuilder();
for (int i = 1; ; i++) {
final Path blockItemPath = blockPath.resolve(i + BLOCK_FILE_EXTENSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface BlockReader<V> {
/**
* Reads the block with the given block number.
*
* @param blockNumber the block number to read
* @param blockNumber the block number of the block to read
* @return the block with the given block number
* @throws IOException if an I/O error occurs fetching the block
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public interface BlockRemover {
/**
* Removes the block with the given block number.
*
* @param id the block number to remove
* @param blockNumber the block number of the block to remove
* @throws IOException if an I/O error occurs removing the block
*/
void remove(final long id) throws IOException;
void remove(final long blockNumber) throws IOException;
}

0 comments on commit d3b4978

Please sign in to comment.