diff --git a/io/blob_store.cc b/io/blob_store.cc index 8346e4ba..990d0d7a 100644 --- a/io/blob_store.cc +++ b/io/blob_store.cc @@ -412,8 +412,8 @@ class BlobStore { std::vector directory_; // two per blob, see `SetRange`. }; // BlobStore -BlobReader::BlobReader(const Path& blob_path) : blob_path_(blob_path) { - PROFILER_ZONE("Startup.BlobReader"); +BlobFinder::BlobFinder(const Path& blob_path) : blob_path_(blob_path) { + PROFILER_ZONE("Startup.BlobFinder"); file_ = OpenFileOrAbort(blob_path, "r"); file_bytes_ = file_->FileSize(); diff --git a/io/blob_store.h b/io/blob_store.h index 82c2357b..6f1548ed 100644 --- a/io/blob_store.h +++ b/io/blob_store.h @@ -46,13 +46,13 @@ struct BlobRange { // Reads `BlobStore` header, converts keys to strings and creates a hash map for // faster lookups. -// TODO(janwas): rename to BlobFinder or similar. +// Finds and manages the location of data blobs within the store. // Thread-safe: it is safe to concurrently call all methods except `CloseFile`. -class BlobReader { +class BlobFinder { public: // Acquires ownership of `file` (which must be non-null) and reads its header. // Aborts on error. - explicit BlobReader(const Path& blob_path); + explicit BlobFinder(const Path& blob_path); const Path& blob_path() const { return blob_path_; } @@ -136,4 +136,4 @@ class BlobWriter { } // namespace gcpp -#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_ +#endif // THIRD_PARTY_GEMMA_CPP_IO_BLOB_STORE_H_ \ No newline at end of file diff --git a/io/blob_store_test.cc b/io/blob_store_test.cc index cf966849..3d7783b4 100644 --- a/io/blob_store_test.cc +++ b/io/blob_store_test.cc @@ -35,6 +35,7 @@ namespace { class BlobStoreTest : public testing::Test {}; #endif +// Change the first argument from BlobFinderTest to BlobStoreTest TEST(BlobStoreTest, TestReadWrite) { ThreadingArgs threading_args; ThreadingContext ctx(threading_args); @@ -59,7 +60,7 @@ TEST(BlobStoreTest, TestReadWrite) { std::fill(buffer.begin(), buffer.end(), 0); - const BlobReader reader(path); + const BlobFinder reader(path); HWY_ASSERT_EQ(reader.Keys().size(), 2); HWY_ASSERT_STRING_EQ(reader.Keys()[0].c_str(), keyA.c_str()); @@ -126,7 +127,7 @@ TEST(BlobStoreTest, TestNumBlobs) { HWY_ASSERT(blobs.size() == num_blobs); writer.Finalize(); - BlobReader reader(path); + BlobFinder reader(path); HWY_ASSERT_EQ(reader.Keys().size(), num_blobs); ParallelFor(