| 1178 | } |
| 1179 | |
| 1180 | StorageFile::StorageFile(int table_fd_, CommonArguments args) |
| 1181 | : StorageFile(args) |
| 1182 | { |
| 1183 | struct stat buf{}; |
| 1184 | int res = fstat(table_fd_, &buf); |
| 1185 | if (-1 == res) |
| 1186 | throw ErrnoException(ErrorCodes::CANNOT_FSTAT, "Cannot execute fstat"); |
| 1187 | total_bytes_to_read = buf.st_size; |
| 1188 | |
| 1189 | if (args.getContext()->getApplicationType() == Context::ApplicationType::SERVER) |
| 1190 | throw Exception(ErrorCodes::DATABASE_ACCESS_DENIED, "Using file descriptor as source of storage isn't allowed for server daemons"); |
| 1191 | if (args.format_name == "Distributed") |
| 1192 | throw Exception(ErrorCodes::INCORRECT_FILE_NAME, "Distributed format is allowed only with explicit file path"); |
| 1193 | |
| 1194 | is_db_table = false; |
| 1195 | use_table_fd = true; |
| 1196 | table_fd = table_fd_; |
| 1197 | setStorageMetadata(args); |
| 1198 | } |
| 1199 | |
| 1200 | StorageFile::StorageFile(FileSource file_source_, CommonArguments args) |
| 1201 | : StorageFile(args) |
nothing calls this directly
no test coverage detected