| 1 | #include "s3key_writer.h" |
| 2 | |
| 3 | void S3KeyWriter::open(const S3Params& params) { |
| 4 | this->params = params; |
| 5 | |
| 6 | S3_CHECK_OR_DIE(this->s3Interface != NULL, S3RuntimeError, "s3Interface must not be NULL"); |
| 7 | S3_CHECK_OR_DIE(this->params.getChunkSize() > 0, S3RuntimeError, "chunkSize must not be zero"); |
| 8 | |
| 9 | buffer.reserve(this->params.getChunkSize()); |
| 10 | |
| 11 | this->uploadId = this->s3Interface->getUploadId(this->params.getS3Url()); |
| 12 | S3_CHECK_OR_DIE(!this->uploadId.empty(), S3RuntimeError, "Failed to get upload id"); |
| 13 | |
| 14 | S3DEBUG("key: %s, upload id: %s", this->params.getS3Url().getFullUrlForCurl().c_str(), |
| 15 | this->uploadId.c_str()); |
| 16 | } |
| 17 | |
| 18 | // write() first fills up the data buffer before flush it out |
| 19 | uint64_t S3KeyWriter::write(const char* buf, uint64_t count) { |
nothing calls this directly
no test coverage detected