You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/08/24 11:12:37 UTC

[GitHub] [james-project] chibenwa commented on a change in pull request #618: [WIP] JAMES-3150 BlobGCService & BloomFilterGCAlgorithm

chibenwa commented on a change in pull request #618:
URL: https://github.com/apache/james-project/pull/618#discussion_r694751486



##########
File path: server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/BlobGCService.java
##########
@@ -0,0 +1,109 @@
+/****************************************************************
+ * 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.server.blob.deduplication;
+
+import static org.apache.james.task.Task.Result;
+
+import java.time.Clock;
+
+import javax.inject.Inject;
+
+import org.apache.james.blob.api.BlobReferenceSource;
+import org.apache.james.blob.api.BlobStore;
+import org.apache.james.blob.api.BlobStoreDAO;
+import org.apache.james.mailbox.cassandra.mail.AttachmentBlobReferenceSource;
+import org.apache.james.mailbox.cassandra.mail.MessageBlobReferenceSource;
+import org.apache.james.mailrepository.cassandra.MailRepositoryBlobReferenceSource;
+import org.apache.james.queue.rabbitmq.view.cassandra.MailQueueViewBlobReferenceSource;
+import org.apache.james.server.blob.deduplication.BloomFilterGCAlgorithm.Context;
+import org.apache.james.task.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+public class BlobGCService {
+
+    public static final int EXPECTED_BLOB_COUNT = 1_000_000;
+    public static final double ASSOCIATED_PROBABILITY = 0.8;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(BlobGCService.class);
+
+    private final BlobStoreDAO blobStoreDAO;
+    private final GenerationAwareBlobId.Factory generationAwareBlobIdFactory;
+    private final GenerationAwareBlobId.Configuration generationAwareBlobIdConfiguration;
+
+    private final MessageBlobReferenceSource messageBlobReferenceSource;
+    private final MailRepositoryBlobReferenceSource mailRepositoryBlobReferenceSource;
+    private final MailQueueViewBlobReferenceSource mailQueueViewBlobReferenceSource;
+    private final AttachmentBlobReferenceSource attachmentBlobReferenceSource;
+    private final Clock clock;
+
+    @Inject
+    public BlobGCService(BlobStoreDAO blobStoreDAO,
+                         GenerationAwareBlobId.Factory generationAwareBlobIdFactory,
+                         GenerationAwareBlobId.Configuration generationAwareBlobIdConfiguration,
+                         MessageBlobReferenceSource messageBlobReferenceSource,
+                         MailRepositoryBlobReferenceSource mailRepositoryBlobReferenceSource,
+                         MailQueueViewBlobReferenceSource mailQueueViewBlobReferenceSource,
+                         AttachmentBlobReferenceSource attachmentBlobReferenceSource,

Review comment:
       Please inject a `Set<BlobReferenceSource>` to NOT have hard dependencies...

##########
File path: server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/BlobGCService.java
##########
@@ -0,0 +1,109 @@
+/****************************************************************
+ * 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.server.blob.deduplication;
+
+import static org.apache.james.task.Task.Result;
+
+import java.time.Clock;
+
+import javax.inject.Inject;
+
+import org.apache.james.blob.api.BlobReferenceSource;
+import org.apache.james.blob.api.BlobStore;
+import org.apache.james.blob.api.BlobStoreDAO;
+import org.apache.james.mailbox.cassandra.mail.AttachmentBlobReferenceSource;
+import org.apache.james.mailbox.cassandra.mail.MessageBlobReferenceSource;
+import org.apache.james.mailrepository.cassandra.MailRepositoryBlobReferenceSource;
+import org.apache.james.queue.rabbitmq.view.cassandra.MailQueueViewBlobReferenceSource;
+import org.apache.james.server.blob.deduplication.BloomFilterGCAlgorithm.Context;
+import org.apache.james.task.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+public class BlobGCService {
+
+    public static final int EXPECTED_BLOB_COUNT = 1_000_000;
+    public static final double ASSOCIATED_PROBABILITY = 0.8;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(BlobGCService.class);
+
+    private final BlobStoreDAO blobStoreDAO;
+    private final GenerationAwareBlobId.Factory generationAwareBlobIdFactory;
+    private final GenerationAwareBlobId.Configuration generationAwareBlobIdConfiguration;
+
+    private final MessageBlobReferenceSource messageBlobReferenceSource;
+    private final MailRepositoryBlobReferenceSource mailRepositoryBlobReferenceSource;
+    private final MailQueueViewBlobReferenceSource mailQueueViewBlobReferenceSource;
+    private final AttachmentBlobReferenceSource attachmentBlobReferenceSource;
+    private final Clock clock;
+
+    @Inject
+    public BlobGCService(BlobStoreDAO blobStoreDAO,

Review comment:
       What for?




-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org