SammyVimes commented on code in PR #950:
URL: https://github.com/apache/ignite-3/pull/950#discussion_r925454707


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/IgniteJraftServiceFactory.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.ignite.internal.raft.storage.impl;
+
+import org.apache.ignite.internal.raft.storage.LogStorageFactory;
+import org.apache.ignite.internal.raft.storage.RaftMetaStorageFactory;
+import org.apache.ignite.internal.raft.storage.SnapshotStorageFactory;
+import org.apache.ignite.raft.jraft.core.DefaultJRaftServiceFactory;
+import org.apache.ignite.raft.jraft.option.RaftOptions;
+import org.apache.ignite.raft.jraft.storage.LogStorage;
+import org.apache.ignite.raft.jraft.storage.RaftMetaStorage;
+import org.apache.ignite.raft.jraft.storage.SnapshotStorage;
+import org.apache.ignite.raft.jraft.storage.impl.LocalRaftMetaStorage;
+import 
org.apache.ignite.raft.jraft.storage.snapshot.local.LocalSnapshotStorage;
+import org.apache.ignite.raft.jraft.util.Requires;
+import org.apache.ignite.raft.jraft.util.StringUtils;
+
+/**
+ * The default factory for JRaft services for Ignite.
+ */
+public class IgniteJraftServiceFactory extends DefaultJRaftServiceFactory {
+    /** Log storage factory .*/
+    private final LogStorageFactory logStorageFactory;
+
+    /** Snapshot storage factory. */
+    private volatile SnapshotStorageFactory snapshotStorageFactory = 
LocalSnapshotStorage::new;
+
+    /** Raft meta storage factory. */
+    private volatile RaftMetaStorageFactory raftMetaStorageFactory = 
LocalRaftMetaStorage::new;
+
+    public IgniteJraftServiceFactory(LogStorageFactory factory) {
+        logStorageFactory = factory;
+    }
+
+    /**
+     * Updates a value of {@link SnapshotStorageFactory} in this service 
factory.
+     */
+    public IgniteJraftServiceFactory 
setSnapshotStorageFactory(SnapshotStorageFactory snapshotStorageFactory) {
+        this.snapshotStorageFactory = snapshotStorageFactory;
+
+        return this;
+    }
+
+    /**
+     * Updates a value of {@link RaftMetaStorageFactory} in this service 
factory.
+     */
+    public IgniteJraftServiceFactory 
setRaftMetaStorageFactory(RaftMetaStorageFactory raftMetaStorageFactory) {
+        this.raftMetaStorageFactory = raftMetaStorageFactory;
+
+        return this;
+    }
+
+    @Override public LogStorage createLogStorage(final String groupId, final 
RaftOptions raftOptions) {

Review Comment:
   `@Override` should be on a separate line



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/DefaultJRaftServiceFactory.java:
##########
@@ -53,4 +49,12 @@ public DefaultJRaftServiceFactory(LogStorageFactory factory) 
{
         Requires.requireTrue(!StringUtils.isBlank(uri), "Blank raft meta 
storage uri.");
         return new LocalRaftMetaStorage(uri, raftOptions);
     }
+
+    @Override public LogEntryCodecFactory createLogEntryCodecFactory() {

Review Comment:
   Override on the same line



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/LogStorageFactory.java:
##########
@@ -33,5 +34,5 @@ public interface LogStorageFactory extends AutoCloseable {
      * @param raftOptions Raft options.
      * @return Log storage.
      */
-    LogStorage getLogStorage(String groupId, RaftOptions raftOptions);
+    LogStorage createLogStorage(String groupId, RaftOptions raftOptions);

Review Comment:
   groupId was uri AFAIR



##########
modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/SnapshotExecutorTest.java:
##########
@@ -16,20 +16,26 @@
  */
 package org.apache.ignite.raft.jraft.storage;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;

Review Comment:
   In the initial fork static imports were after normal ones



##########
modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/impl/VolatileRaftMetaStorageTest.java:
##########
@@ -17,19 +17,18 @@
 
 package org.apache.ignite.raft.jraft.storage.impl;
 
-import org.apache.ignite.raft.jraft.entity.PeerId;
-import org.apache.ignite.raft.jraft.option.RaftMetaStorageOptions;
-import org.apache.ignite.raft.jraft.storage.VolatileStorage;
-import org.junit.jupiter.api.Test;
-
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.instanceOf;
 import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
 import static org.hamcrest.Matchers.sameInstance;
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+import org.apache.ignite.raft.jraft.entity.PeerId;

Review Comment:
   are you sure about import order?



-- 
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]

Reply via email to