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

Function addEntryToIovecs

bolt/common/caching/SsdFile.cpp:77–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75void addEntryToIovecs(AsyncDataCacheEntry& entry, std::vector<iovec>& iovecs) {
76 if (entry.tinyData() != nullptr) {
77 iovecs.push_back({entry.tinyData(), static_cast<size_t>(entry.size())});
78 return;
79 }
80 const auto& data = entry.data();
81 iovecs.reserve(iovecs.size() + data.numRuns());
82 int64_t bytesLeft = entry.size();
83 for (auto i = 0; i < data.numRuns(); ++i) {
84 auto run = data.runAt(i);
85 iovecs.push_back(
86 {run.data<char>(), std::min<size_t>(bytesLeft, run.numBytes())});
87 bytesLeft -= run.numBytes();
88 if (bytesLeft <= 0) {
89 break;
90 };
91 }
92}
93} // namespace
94
95SsdPin::SsdPin(SsdFile& file, SsdRun run) : file_(&file), run_(run) {
96 file_->checkPinned(run_.offset());
97}

Callers 1

writeMethod · 0.85

Calls 8

tinyDataMethod · 0.80
numRunsMethod · 0.80
runAtMethod · 0.80
numBytesMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected