Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
You will write a BlobStore based DeletedMessageVault implementation where it has:
- a dedicated component(DeletedMessageMetadataVault) to store metadata in order to have reasonable searching performance (
JAMES-2807) - the capability of choosing bucket in BlobStore as the proposal
JAMES-2806described
- Append
you also have to implement a related method loadMimeMessage()
class BlobStoreDeletedMessageVault implements DeletedMessageVault { private final DeletedMessageMetadataVault metadataVault; private final BlobStore blobStore; Mono<Void> append(User user, DeletedMessage message, InputStream mimeMessage) { BlobId deletedMessageFileName = calculateFileName(message); blobStore .store(mimeMessage, deletedMessageFileName, calculateCurrentBucket()); metadataVault.store(calculateCurrentBucket(), message); } Mono<InputStream> loadMimeMessage(User user, MessageId messageId) { .... } }
Pattern for BucketName: `deletedMessages-2019-06-01` where 2019 is the year and 06 the month. 01 is used to later allow smaller bucket definition.
- Searching ontop of DeletedMessageMetadataVault
JAMES-2807
- retrieve all available buckets from DeletedMessageMetadataVault
- for each bucket, use retrieve all deleted message metadata of corresponding user
- filter records match with query criteria
class BlobStoreDeletedMessageVault implements DeletedMessageVault { private DeletedMessageMetadataVault metadataVault; Flux<DeletedMessage> search(User user, Query query) { return metadataVault.listContainers() .flatMap(containerName -> metadataVault.listMessages(containerName, user)) .filter(deletedMessage -> matches(deletedMessage, query)); } }