MCPcopy Create free account
hub / github.com/deepseek-ai/3FS / writeFileAndCheck

Function writeFileAndCheck

src/client/cli/admin/Bench.cc:50–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50CoTryTask<Void> writeFileAndCheck(AdminEnv &env,
51 const Path &path,
52 std::string_view str,
53 uint32_t repeat,
54 Duration timeout,
55 uint32_t crc32c) {
56 auto openResult = co_await FileWrapper::openOrCreateFile(env, path, true);
57 CO_RETURN_AND_LOG_ON_ERROR(openResult);
58 auto &file = *openResult;
59
60 boost::iostreams::stream<boost::iostreams::basic_array_source<char>> stream(str.begin(), str.size());
61 auto writeResult = co_await file.writeFile(stream, str.size(), 0, 10_s);
62 CO_RETURN_AND_LOG_ON_ERROR(writeResult);
63 CO_RETURN_AND_LOG_ON_ERROR(check(path, crc32c, *writeResult));
64
65 std::ofstream out("/dev/null");
66 auto readResult =
67 co_await file.readFile(out, str.size(), 0, true, false, storage::client::TargetSelectionMode::HeadTarget);
68 CO_RETURN_AND_LOG_ON_ERROR(readResult);
69 CO_RETURN_AND_LOG_ON_ERROR(check(path, crc32c, *readResult));
70
71 readResult =
72 co_await file.readFile(out, str.size(), 0, true, false, storage::client::TargetSelectionMode::TailTarget);
73 CO_RETURN_AND_LOG_ON_ERROR(readResult);
74 CO_RETURN_AND_LOG_ON_ERROR(check(path, crc32c, *readResult));
75 co_return Void{};
76}
77
78CoTryTask<Dispatcher::OutputTable> handleWriteFile(IEnv &ienv,
79 const argparse::ArgumentParser &parser,

Callers 1

handleWriteFileFunction · 0.85

Calls 5

checkFunction · 0.85
writeFileMethod · 0.80
readFileMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected