You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/07/20 11:25:16 UTC

[GitHub] [ignite-3] ibessonov commented on a diff in pull request #950: IGNITE-17393 Some code rolled back from jraft sources and redone in a less invasive way.

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


##########
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:
   Thank you



##########
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:
   I'll fix it



-- 
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@ignite.apache.org

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