Repository navigation
Conversation
LMCROSSITXSADEPLOY-3312
|
| String region = ((String) credentials.get(CredentialKeys.REGION)).substring( | ||
| 4); // so we can remove the "oss-" part, because it does not work with V4 signing |
There was a problem hiding this comment.
If we receive something other than oss- this will break. Can you use replace("oss-", "")
| config.setConnectionTimeout((int) ObjectStoreConstants.ALI_OBJECT_STORE_CONNECTION_TIMEOUT_CONFIG_IN_SECONDS.toMillis()); | ||
| config.setSocketTimeout((int) ObjectStoreConstants.ALI_OBJECT_STORE_SOCKET_TIMEOUT_CONFIG_IN_MINUTES.toMillis()); | ||
| config.setRequestTimeoutEnabled(true); | ||
| config.setRequestTimeout((int) ObjectStoreConstants.ALI_OBJECT_STORE_REQUEST_TIMEOUT_CONFIG_IN_MINUTES.toMillis()); |
| LOGGER.debug(MessageFormat.format(Messages.DELETED_FILE_WITH_ID_0_AND_SPACE_1, id, space)); | ||
| } catch (OSSException | ClientException e) { | ||
| LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_OPERATION_0_FAILED_FOR_KEY_1, "deleteObject", id, describe(e))); | ||
| throw e; |
There was a problem hiding this comment.
Throw FileStorageException not the incomming one
| } catch (OSSException | ClientException e) { | ||
| LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_CONNECTION_TEST_FAILED_FOR_BUCKET_0_ENDPOINT_1, bucketName, | ||
| endpoint, describe(e))); | ||
| throw e; |
There was a problem hiding this comment.
throw FileStorageException
| ossObject = ossClient.getObject(request); | ||
| } catch (OSSException | ClientException e) { | ||
| LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_OPERATION_0_FAILED_FOR_KEY_1, "getObject", id, describe(e))); | ||
| throw e; |
There was a problem hiding this comment.
throw FileStorageException
| } while (listing.isTruncated()); | ||
| } catch (OSSException | ClientException e) { | ||
| LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_LISTING_FAILED_FOR_BUCKET_0, bucketName, describe(e))); | ||
| throw e; |
There was a problem hiding this comment.
throw FileStorageException
| ObjectMetadata metadata = new ObjectMetadata(); | ||
| metadata.setContentLength(fileSize); | ||
| metadata.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); | ||
| metadata.setContentDisposition(fileEntry.getName()); | ||
| metadata.setUserMetadata(ObjectStoreMapper.createFileEntryMetadata(fileEntry)); |
There was a problem hiding this comment.
i would separate it to a new method because this a long method
| .map(objectSummary -> CompletableFuture.supplyAsync(() -> fetchMetadataAndFilter(objectSummary.getKey(), predicate), | ||
| executor)) | ||
| .toList() | ||
| .stream() | ||
| .map(CompletableFuture::join) | ||
| .filter(Objects::nonNull) | ||
| .toList(); |
There was a problem hiding this comment.
why dont you do the second map right after the first one instead calling toList?
| try { | ||
| do { | ||
| listing = ossClient.listObjects(request); | ||
| pageConsumer.accept(listing.getObjectSummaries()); | ||
| request.setMarker(listing.getNextMarker()); | ||
| } while (listing.isTruncated()); |
There was a problem hiding this comment.
Separate the do-while in a new method because there are nested structures.
P.S wow, haven't seen do-while in a while. no pun intended :D


Migrating from JClouds OS to AliCloud OS
LMCROSSITXSADEPLOY-3312