| 83 | } |
| 84 | |
| 85 | std::unique_ptr<ReadBufferFromFileBase> PackedFilesReader::readFile( |
| 86 | const DiskPtr & disk, |
| 87 | const String & data_file_name, |
| 88 | const String & file_name, |
| 89 | const ReadSettings & settings, |
| 90 | std::optional<size_t> read_hint) const |
| 91 | { |
| 92 | auto it = index.find(file_name); |
| 93 | if (it == index.end()) |
| 94 | throw Exception(ErrorCodes::FILE_DOESNT_EXIST, "File {} does not exist", file_name); |
| 95 | |
| 96 | const auto & [offset, size] = it->second; |
| 97 | |
| 98 | /// ReadBufferFromFileView doesn't support reading with mmap and direct io methods, because |
| 99 | /// they require special alignment which cannot be achieved while reading archive file. |
| 100 | /// So just disable them. |
| 101 | auto in = disk->readFile(data_file_name, patchSettings(settings), read_hint); |
| 102 | return std::make_unique<ReadBufferFromFileView>(std::move(in), file_name, offset, offset + size); |
| 103 | } |
| 104 | |
| 105 | } |
no test coverage detected