MCPcopy Create free account
hub / github.com/bytedance/bolt / loadNFiles

Method loadNFiles

bolt/common/caching/tests/AsyncDataCacheTest.cpp:498–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498void AsyncDataCacheTest::loadNFiles(
499 int32_t numFiles,
500 std::vector<int64_t> offsets) {
501 Semaphore semaphore(0);
502
503 std::vector<Request> batch;
504 int32_t numLoads = 0;
505 for (auto file = 0; file < numFiles; ++file) {
506 auto fileNum = filenames_[file].id();
507 if (auto instance = CacheTTLController::getInstance()) {
508 instance->addOpenFileInfo(fileNum);
509 }
510 for (auto i = 0; i < offsets.size() - 1; i++) {
511 batch.emplace_back(offsets[i], offsets[i + 1] - offsets[i]);
512 if (batch.size() == 8 || i == (offsets.size() - 2)) {
513 loadBatch(fileNum, batch, false, &semaphore);
514 batch.clear();
515 numLoads +=
516 2; // One TestingCoalescedSsdLoad and one TestingCoalescedLoad.
517 }
518 }
519 }
520
521 for (auto i = 0; i < numLoads; i++) {
522 semaphore.acquire();
523 }
524}
525
526void AsyncDataCacheTest::loadLoop(
527 int64_t startOffset,

Callers

nothing calls this directly

Calls 5

addOpenFileInfoMethod · 0.80
idMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
acquireMethod · 0.45

Tested by

no test coverage detected