jeantil commented on a change in pull request #474:
URL: https://github.com/apache/james-project/pull/474#discussion_r647481659
##########
File path:
server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/cache/CachedBlobStore.java
##########
@@ -138,17 +138,19 @@ public InputStream read(BucketName bucketName, BlobId
blobId, StoragePolicy stor
if (storagePolicy == LOW_COST) {
return backend.read(bucketName, blobId);
}
- return Mono.just(bucketName)
- .filter(getDefaultBucketName()::equals)
- .flatMap(defaultBucket -> readInDefaultBucket(bucketName, blobId))
- .switchIfEmpty(readFromBackend(bucketName, blobId))
+ if (bucketName.equals(getDefaultBucketName())) {
Review comment:
I guess I am put off by the repetition of the error handling block, it's
bigger than the code it protects and makes the difference between the 2
conditional branches harder to spot.
```java
.blockOptional()
.orElseThrow(() -> new ObjectNotFoundException(String.format("Could not
retrieve blob metadata for %s", blobId.asString())));
```
defining
```java
private Mono<InputStream> readFromBucket(String bucketName){
if (bucketName.equals(getDefaultBucketName())) {
return readInDefaultBucket(bucketName, blobId)
} else {
return readFromBackend(bucketName, blobId)
}
}
```
maybe ?
if I understand correctly the special casing of `readInDefaultBucket` is
done only because there is caching on the default bucket ...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]