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