| 48 | } |
| 49 | |
| 50 | CoTryTask<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 | |
| 78 | CoTryTask<Dispatcher::OutputTable> handleWriteFile(IEnv &ienv, |
| 79 | const argparse::ArgumentParser &parser, |