chibenwa commented on a change in pull request #624:
URL: https://github.com/apache/james-project/pull/624#discussion_r697971106
##########
File path: pom.xml
##########
@@ -1147,6 +1147,11 @@
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>blob-strategy-guice</artifactId>
Review comment:
Guice modules are registered in `server/container/guice/pom.xml` only...
##########
File path:
server/apps/distributed-app/src/main/java/org/apache/james/CassandraRabbitMQJamesServerMain.java
##########
@@ -127,7 +129,7 @@
new CassandraQuotaMailingModule());
private static final Module BLOB_MODULE = Modules.combine(
- new BlobStoreAPIModule(),
+ new BlobStrategyModule(),
Review comment:
Can we try to bing the GC task **only if** deduplication is enabled?
If we do not have deduplication, it is mostly useless...
We can do that by moving the bindings somewhere within the BlobStore module
chooser, in the modules responsible for deduplication...
##########
File path: server/container/guice/pom.xml
##########
@@ -37,6 +37,7 @@
<module>blob/export</module>
<module>blob/memory</module>
<module>blob/s3</module>
+ <module>blob/strategy</module>
Review comment:
Why do we need this new module for?
##########
File path:
server/container/guice/blob/strategy/src/main/java/org/apache/james/modules/blobstore/BlobStrategyModule.java
##########
@@ -0,0 +1,105 @@
+/****************************************************************
+ * 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.modules.blobstore;
+
+import java.time.Clock;
+import java.util.Set;
+
+import org.apache.james.blob.api.BlobId;
+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.blob.api.HashBlobId;
+import org.apache.james.blob.api.MetricableBlobStore;
+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.BlobGCTaskAdditionalInformationDTO;
+import org.apache.james.server.blob.deduplication.BlobGCTaskDTO;
+import org.apache.james.server.blob.deduplication.GenerationAwareBlobId;
+import org.apache.james.server.task.json.dto.AdditionalInformationDTO;
+import org.apache.james.server.task.json.dto.AdditionalInformationDTOModule;
+import org.apache.james.server.task.json.dto.TaskDTO;
+import org.apache.james.server.task.json.dto.TaskDTOModule;
+import org.apache.james.task.Task;
+import org.apache.james.task.TaskExecutionDetails;
+import org.apache.james.webadmin.dto.DTOModuleInjections;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.multibindings.ProvidesIntoSet;
+import com.google.inject.name.Named;
+
+public class BlobStrategyModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ Multibinder<BlobReferenceSource> multiBinder =
Multibinder.newSetBinder(binder(),
+ BlobReferenceSource.class);
+
+ multiBinder.addBinding().to(AttachmentBlobReferenceSource.class);
+ multiBinder.addBinding().to(MailQueueViewBlobReferenceSource.class);
+ multiBinder.addBinding().to(MailRepositoryBlobReferenceSource.class);
+ multiBinder.addBinding().to(MessageBlobReferenceSource.class);
Review comment:
The idea behind the multi-binder is that you don't need the registration
to be in a single place.
Please move those in `RabbitMQModule` `CassandraMailRepositoryModule`
`CassandraMailboxModule`...
##########
File path: server/container/guice/blob/strategy/pom.xml
##########
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice</artifactId>
+ <version>3.7.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>blob-strategy-guice</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache James :: Server :: Blob Storage Strategy - guice
injection</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>apache-james-mailbox-cassandra</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>blob-memory</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>blob-storage-strategy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>james-server-mailrepository-cassandra</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>james-server-queue-rabbitmq</artifactId>
+ </dependency>
Review comment:
Please remove `james-server-mailrepository-cassandra` and
`james-server-queue-rabbitmq`
(Because we could be using this GC task with other sets of technologies :-p
)
##########
File path: server/container/guice/pom.xml
##########
@@ -37,6 +37,7 @@
<module>blob/export</module>
<module>blob/memory</module>
<module>blob/s3</module>
+ <module>blob/strategy</module>
Review comment:
Let me also suggest `blob/deduplication-gc` as a more explicit name :-P
--
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]