| 95 | }; |
| 96 | |
| 97 | Result<std::shared_ptr<FileSystem>> SlowFileSystemFactory(const Uri& uri, |
| 98 | const io::IOContext& io_context, |
| 99 | std::string* out_path) { |
| 100 | auto local_uri = "file" + uri.ToString().substr(uri.scheme().size()); |
| 101 | ARROW_ASSIGN_OR_RAISE(auto base_fs, FileSystemFromUri(local_uri, io_context, out_path)); |
| 102 | double average_latency = 1; |
| 103 | int32_t seed = 0xDEADBEEF; |
| 104 | ARROW_ASSIGN_OR_RAISE(auto params, uri.query_items()); |
| 105 | for (const auto& [key, value] : params) { |
| 106 | if (key == "average_latency") { |
| 107 | average_latency = std::stod(value); |
| 108 | } |
| 109 | if (key == "seed") { |
| 110 | seed = std::stoi(value, nullptr, /*base=*/16); |
| 111 | } |
| 112 | } |
| 113 | return std::make_shared<SlowFileSystemPublicProps>(base_fs, average_latency, seed); |
| 114 | } |
| 115 | auto kSlowFileSystemModule = |
| 116 | ARROW_REGISTER_FILESYSTEM("slowfile", SlowFileSystemFactory, {}); |
| 117 | |