JAMES-4182 Proposal for changes in BlobStoreDAO interface#2960
JAMES-4182 Proposal for changes in BlobStoreDAO interface#2960chibenwa wants to merge 17 commits intoapache:masterfrom
Conversation
I think we should only use dedicated properties to store acitvely managed metadata, the remaining metadata as a Map<String,String> can be serializaed with the payload. this avoids possible capability conflicts between blog stores. |
jeantil
left a comment
There was a problem hiding this comment.
Looks like a good direction to me, I left some comments, I'm sure there are which you are aware of and will addres, feel free to close on sight
server/blob/blob-api/src/main/java/org/apache/james/blob/api/BlobStoreDAO.java
Show resolved
Hide resolved
| } | ||
|
|
||
| sealed interface Blob { | ||
| Map<BlobMetadataName, BlobMetadataValue> metadata(); |
There was a problem hiding this comment.
As mentionned above it would be better for keys to be known,
alternatively this could be an object with kmown fields which james cares about and a map for extra fields which are not interpreted by james
server/blob/blob-api/src/main/java/org/apache/james/blob/api/BlobStoreDAO.java
Show resolved
Hide resolved
server/blob/blob-api/src/main/java/org/apache/james/blob/api/BlobStoreDAO.java
Outdated
Show resolved
Hide resolved
server/blob/blob-api/src/main/java/org/apache/james/blob/api/BlobStoreDAO.java
Outdated
Show resolved
Hide resolved
server/blob/blob-memory/src/main/java/org/apache/james/blob/memory/MemoryBlobStoreDAO.java
Outdated
Show resolved
Hide resolved
server/blob/blob-aes/src/main/java/org/apache/james/blob/aes/AESBlobStoreDAO.java
Outdated
Show resolved
Hide resolved
server/blob/blob-api/src/main/java/org/apache/james/blob/api/BlobStoreDAO.java
Outdated
Show resolved
Hide resolved
|
@jeantil do we have an agreement on continuing this work with an open metadata model? |
I'm not comfortable working with only the open metadata model. I understand the extension point argument but |
I propose:
Essentially: I think it keeps the underlying data model simple, extensible, easy to work with in DAOs, and it address your concerns and makes James-used metadata a prime citizen. |
|
this looks ok for me, ideally we can enforce usage of an immutable map especially if it remains accessible from outside |
Of course ;-) |
|
I'd like to thank you for the review effort @jeantil I will put together the effort to align the code with the comments, and continue the implementation likely next week. |
f813896 to
afa20c1
Compare
|
Hello @jeantil I did rework the metadata model and wrote memory implementation. I'll carry other with other impelementation when I have time, but wanted to push now to enable early review, in case people have time. |
server/blob/blob-api/src/main/java/org/apache/james/blob/api/BlobStoreDAO.java
Outdated
Show resolved
Hide resolved
|
|
||
| Mono.from(testee.save(TEST_BUCKET_NAME, TEST_BLOB_ID, bytesBlob)).block(); | ||
|
|
||
| assertThat(Mono.from(testee.readBytes(TEST_BUCKET_NAME, TEST_BLOB_ID)).block().metadata().metadata()) |
There was a problem hiding this comment.
I'll use this one as an example to let you pick the variant you prefer, I'm fine with both :D
| assertThat(Mono.from(testee.readBytes(TEST_BUCKET_NAME, TEST_BLOB_ID)).block().metadata().metadata()) | |
| assertThat(Mono.from(testee.readBytes(TEST_BUCKET_NAME, TEST_BLOB_ID)).block().metadata().values()) | |
| assertThat(Mono.from(testee.readBytes(TEST_BUCKET_NAME, TEST_BLOB_ID)).block().metadata().underlyingMap()) |
S3MinioTest::saveShouldWorkWhenValidBlobId failed
org.opentest4j.AssertionFailedError:
expected: BytesBlob[payload=[B@6bca6c4c, metadata=BlobMetadata[metadata={}]]
but was: BytesBlob[payload=[B@507e3e77, metadata=BlobMetadata[metadata={}]]
Expected :BytesBlob[payload=[B@6bca6c4c, metadata=BlobMetadata[metadata={}]]
Actual :BytesBlob[payload=[B@507e3e77, metadata=BlobMetadata[metadata={}]]
By default, java compares byte[] array by their reference, not the inner bytes.
…cketWhenFailingOnDefaultOne test
…nderlying BlobStoreDAO
afa20c1 to
6110c88
Compare
|
Hello, I would like to help to move on this work. I rebased this work on master, fixed the compilation, adapted review comments, and fixed some blob store tests. Status: You can review the appended commits since the JAMES-4182 Fix compilation commit. I propose to split the blob metadata storage for other implementations (S3, file, Cassandra, Postgres) into other PRs. Also, should we fire a mailing list thread to draw the potential community's attention and feedback on this topic, if any? |
|
Good with me! Thanks for the help on this @quantranhong1999 |
It seems YES. I will have a look tomorrow. |
cf S3 object's metadata key is case-insensitive (normalized to lowercase)
|
Green build. Let's wait for @jeantil review on this :-). |
|
+1 OK with me |
See WIP: #3001 |
Opened to collect initial feedback
See https://issues.apache.org/jira/browse/JAMES-4182 for context
Remaining points: