Skip to content

Commit d3b4978

Browse files
fix: fixing comments and var names
Signed-off-by: Matt Peterson <matt.peterson@swirldslabs.com>
1 parent 89fb31e commit d3b4978

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

server/src/main/java/com/hedera/block/server/persistence/storage/BlockAsDirReader.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,15 @@ public Optional<Block> read(final long blockNumber) throws IOException {
8484

8585
try {
8686
// There may be thousands of BlockItem files in a Block directory.
87-
// The BlockItems must be added to the Block object in order. A
88-
// DirectoryStream will iterate without any guaranteed order. To avoid sorting,
89-
// and to keep the retrieval process linear with the number of BlockItems,
90-
// Run a loop to fetch in the order we need. The loop will break when
91-
// it looks for a BlockItem file that does not exist.
87+
// The BlockItems must be added to the outbound Block object in order.
88+
// However, using something like DirectoryStream will iterate without
89+
// any guaranteed order. To avoid sorting and to keep the retrieval
90+
// process linear with the number of BlockItems in the Block, run a loop
91+
// to fetch BlockItems in the expected order. For example, in a Block
92+
// directory "1" containing 10 BlockItem files (1.blk, 2.blk, 3.blk, ...,
93+
// 10.blk), the loop will directly fetch the BlockItems in order based on
94+
// their file names. The loop will exit when it attempts to read a
95+
// BlockItem file that does not exist (e.g., 11.blk).
9296
final Builder builder = Block.newBuilder();
9397
for (int i = 1; ; i++) {
9498
final Path blockItemPath = blockPath.resolve(i + BLOCK_FILE_EXTENSION);

server/src/main/java/com/hedera/block/server/persistence/storage/BlockReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public interface BlockReader<V> {
2929
/**
3030
* Reads the block with the given block number.
3131
*
32-
* @param blockNumber the block number to read
32+
* @param blockNumber the block number of the block to read
3333
* @return the block with the given block number
3434
* @throws IOException if an I/O error occurs fetching the block
3535
*/

server/src/main/java/com/hedera/block/server/persistence/storage/BlockRemover.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public interface BlockRemover {
2424
/**
2525
* Removes the block with the given block number.
2626
*
27-
* @param id the block number to remove
27+
* @param blockNumber the block number of the block to remove
2828
* @throws IOException if an I/O error occurs removing the block
2929
*/
30-
void remove(final long id) throws IOException;
30+
void remove(final long blockNumber) throws IOException;
3131
}

0 commit comments

Comments
 (0)