| 182 | } |
| 183 | |
| 184 | void S3KeyReader::open(const S3Params& params) { |
| 185 | S3_CHECK_OR_DIE(this->s3Interface != NULL, S3RuntimeError, "s3Interface must not be NULL"); |
| 186 | |
| 187 | this->sharedError = false; |
| 188 | |
| 189 | this->numOfChunks = params.getNumOfChunks(); |
| 190 | S3_CHECK_OR_DIE(this->numOfChunks > 0, S3RuntimeError, "numOfChunks must not be zero"); |
| 191 | |
| 192 | this->offsetMgr.setKeySize(params.getKeySize()); |
| 193 | this->offsetMgr.setChunkSize(params.getChunkSize()); |
| 194 | |
| 195 | S3_CHECK_OR_DIE(params.getChunkSize() > 0, S3RuntimeError, |
| 196 | "chunk size must be greater than zero"); |
| 197 | |
| 198 | this->chunkBuffers.reserve(this->numOfChunks); |
| 199 | |
| 200 | for (uint64_t i = 0; i < this->numOfChunks; i++) { |
| 201 | this->chunkBuffers.emplace_back(params.getS3Url(), *this, params.getMemoryContext()); |
| 202 | } |
| 203 | |
| 204 | for (uint64_t i = 0; i < this->numOfChunks; i++) { |
| 205 | this->chunkBuffers[i].setS3InterfaceService(this->s3Interface); |
| 206 | |
| 207 | pthread_t thread; |
| 208 | pthread_create(&thread, NULL, DownloadThreadFunc, &this->chunkBuffers[i]); |
| 209 | this->threads.push_back(thread); |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | uint64_t S3KeyReader::read(char* buf, uint64_t count) { |
| 214 | uint64_t fileLen = this->offsetMgr.getKeySize(); |
nothing calls this directly
no test coverage detected