Skip to content

Commit

Permalink
convert clients to step_range
Browse files Browse the repository at this point in the history
  • Loading branch information
battlmonstr committed Oct 14, 2024
1 parent a276230 commit 9d585f6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion silkworm/db/blocks/bodies/body_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BodyIndex {
return {
.index_file = segment_path.index_file(),
.key_factory = std::make_unique<KeyFactory>(),
.base_data_id = segment_path.block_range().start,
.base_data_id = segment_path.step_range().to_block_num_range().start,
};
}
};
Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/blocks/headers/header_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class HeaderIndex {
return {
.index_file = segment_path.index_file(),
.key_factory = std::make_unique<KeyFactory>(),
.base_data_id = segment_path.block_range().start,
.base_data_id = segment_path.step_range().to_block_num_range().start,
};
}
};
Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/blocks/headers/header_snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct HeaderSnapshotWordDeserializer : public SnapshotWordDeserializer {
}

void check_sanity_with_metadata(const SnapshotPath& path) override {
check_sanity_of_header_with_metadata(value, path.block_range());
check_sanity_of_header_with_metadata(value, path.step_range().to_block_num_range());
}
};

Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/datastore/snapshots/snapshot_bundle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct SnapshotBundle : public SnapshotBundleData {
}

// assume that all snapshots have the same block range, and use one of them
BlockNumRange block_range() const { return header_snapshot.path().block_range(); }
BlockNumRange block_range() const { return header_snapshot.path().step_range().to_block_num_range(); }
size_t block_count() const { return block_range().size(); }

std::vector<std::filesystem::path> files();
Expand Down
4 changes: 2 additions & 2 deletions silkworm/db/datastore/snapshots/snapshot_path_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ TEST_CASE("SnapshotPath::parse", "[silkworm][node][snapshot]") {
if (snapshot_file) {
CHECK(snapshot_file->path() == filename_expectation.filename);
CHECK(snapshot_file->version() == 1);
CHECK(snapshot_file->block_range() == filename_expectation.block_num_range);
CHECK(snapshot_file->step_range() == StepRange::from_block_num_range(filename_expectation.block_num_range));
CHECK(snapshot_file->type() == filename_expectation.type);
const SnapshotPath index_file = snapshot_file->index_file();
CHECK(index_file.path().stem() == snapshot_file->path().stem());
CHECK(index_file.path().extension() == kIdxExtension);
CHECK(index_file.version() == 1);
CHECK(index_file.block_range() == filename_expectation.block_num_range);
CHECK(index_file.step_range() == StepRange::from_block_num_range(filename_expectation.block_num_range));
CHECK(index_file.type() == filename_expectation.type);
}
}
Expand Down
2 changes: 1 addition & 1 deletion silkworm/db/snapshot_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Task<void> SnapshotSync::download_snapshots() {
const auto [_, inserted] = snapshot_set.insert(snapshot_file);
SILKWORM_ASSERT(inserted);
SILK_INFO << "SnapshotSync: download completed for: " << snapshot_file.filename().string()
<< " blocks " << SnapshotPath::parse(snapshot_file)->block_range().to_string()
<< " steps " << SnapshotPath::parse(snapshot_file)->step_range().to_string()
<< " [" << (completed + 1) << "/" << num_snapshots << "]";
}
}
Expand Down
4 changes: 2 additions & 2 deletions silkworm/db/transactions/txn_to_block_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TransactionToBlockIndex {
std::nullopt,
std::move(segment_path),
std::nullopt,
segment_path.block_range().start);
segment_path.step_range().to_block_num_range().start);
}

static IndexBuilder make(
Expand All @@ -80,7 +80,7 @@ class TransactionToBlockIndex {
bodies_segment_region,
std::move(segment_path),
segment_region,
segment_path.block_range().start);
segment_path.step_range().to_block_num_range().start);
}

static IndexBuilder make(
Expand Down

0 comments on commit 9d585f6

Please sign in to comment.