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

Function writeDataAsync

bolt/common/file/tests/AsyncFileTest.cpp:30–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28constexpr int kOneMB = 1 << 20;
29
30void writeDataAsync(WriteFile* writeFile) {
31 if (writeFile->uringEnabled()) {
32 std::vector<std::unique_ptr<folly::IOBuf>> buffers;
33 buffers.push_back(folly::IOBuf::copyBuffer("aaaaa"));
34 buffers.push_back(folly::IOBuf::copyBuffer("bbbbb"));
35 buffers.push_back(folly::IOBuf::copyBuffer(std::string(kOneMB, 'c')));
36 buffers.push_back(folly::IOBuf::copyBuffer("ddddd"));
37 for (int i = 0; i < buffers.size(); i++)
38 writeFile->submitWrite(buffers[i].get(), i);
39 writeFile->waitForCompleteAll();
40 } else {
41 std::unique_ptr<folly::IOBuf> buf = folly::IOBuf::copyBuffer("aaaaa");
42 buf->appendToChain(folly::IOBuf::copyBuffer("bbbbb"));
43 buf->appendToChain(folly::IOBuf::copyBuffer(std::string(kOneMB, 'c')));
44 buf->appendToChain(folly::IOBuf::copyBuffer("ddddd"));
45 writeFile->append(std::move(buf));
46 }
47 ASSERT_EQ(writeFile->size(), 15 + kOneMB);
48}
49
50void readDataAsync(ReadFile* readFile, bool checkFileSize = true) {
51 if (checkFileSize) {

Callers 1

TESTFunction · 0.85

Calls 7

uringEnabledMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
submitWriteMethod · 0.45
getMethod · 0.45
waitForCompleteAllMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected