| 22 | } |
| 23 | |
| 24 | string GPWriter::genUniqueKeyName(const S3Url& s3Url) { |
| 25 | string fullUrl = s3Url.getFullUrlForCurl(); |
| 26 | |
| 27 | while (true) { |
| 28 | stringstream ss; |
| 29 | ss << s3ext_segid << this->constructRandomStr() << "." << this->format; |
| 30 | |
| 31 | if (!this->s3InterfaceService.checkKeyExistence( |
| 32 | S3Url((fullUrl + ss.str()), (s3Url.getSchema() == "https"), s3Url.getVersion(), |
| 33 | s3Url.getRegion()))) { |
| 34 | string keyName = ss.str(); |
| 35 | return s3Url.getPrefix() + keyName; |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | string GPWriter::constructRandomStr() { |
| 41 | int randomDevice = ::open("/dev/urandom", O_RDONLY); |
no test coverage detected