chibenwa commented on code in PR #2902: URL: https://github.com/apache/james-project/pull/2902#discussion_r2704909826
########## mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/blob/BlobIdTimeGenerator.java: ########## @@ -0,0 +1,42 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.vault.blob; + +import java.time.Clock; +import java.time.ZonedDateTime; +import java.util.UUID; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.james.blob.api.BlobId; +import org.apache.james.blob.api.PlainBlobId; + +public class BlobIdTimeGenerator { Review Comment: Hello @jeantil Issue is that while discussing of pragmatic code changes that enhance daily life of practitionners we uncover design flows that lead to methaphorical conceptual problem. > My understanding is that the Factory is responsible for creating instances of BlobId that point to a specific object (generate BlobIds) ``` public interface BlobId { interface Factory { BlobId of(String id); BlobId parse(String id); } String asString(); } ``` I see no generate method. Generation is an actual responsibility of the BlobStore, or of its caller. Proof: - https://github.com/apache/james-project/blob/aef61d6fc9655698a8bff1521398ff110388e2d1/server/blob/blob-storage-strategy/src/main/scala/org/apache/james/server/blob/deduplication/PassThroughBlobStore.scala#L93 - https://github.com/apache/james-project/blob/aef61d6fc9655698a8bff1521398ff110388e2d1/server/blob/blob-storage-strategy/src/main/scala/org/apache/james/server/blob/deduplication/DeDuplicationBlobStore.scala#L103 At the minimum a concrete clarification would be a `s/of/wrap/g` or `s/of/decorate/g` - if this sounds relevant to others I agree opening sucha PR. Please note that in the example taken: `BlobMailRepository`: ``` val blobId = blobIdFactory.of(mailKey.asString()) ``` The decision to rely on a MailKey as the storage identifier is not ecoded in the BlobId.Factory either. > I was kinda expecting a TimePrefixedBlobIdFactory TBH as we are not actively using the date information encoded in the object name this present little added value to operate of a "typed" blobId. The only use of information encoded by the blobId to a useful process is to my knowledge the GC to leverage a grace period cf https://github.com/apache/james-project/blob/aef61d6fc9655698a8bff1521398ff110388e2d1/server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/BloomFilterGCAlgorithm.java#L277 Also my consern about "typed" BlobId is that it interoperate badly. The beauty of the proposed design here (PlainBloId factory) is that we naturally handle historical data without needing some complex fallback logic for an information that is not actually needed. Cheers. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
