Add ShardPeerAddressResolver
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DatastoreContext.java
index e0c243b5b41ddf3612248e8fc3fec6ab31fd84d3..4d952a725f5492bfd8cb92eb5fc36f315fe11e58 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
 import org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader;
 import org.opendaylight.controller.cluster.raft.ConfigParams;
 import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl;
+import org.opendaylight.controller.cluster.raft.PeerAddressResolver;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
 import scala.concurrent.duration.Duration;
 import scala.concurrent.duration.FiniteDuration;
@@ -111,7 +112,7 @@ public class DatastoreContext {
         setElectionTimeoutFactor(other.raftConfig.getElectionTimeoutFactor());
         setCustomRaftPolicyImplementation(other.customRaftPolicyImplementation);
         setShardSnapshotChunkSize(other.raftConfig.getSnapshotChunkSize());
-
+        setPeerAddressResolver(other.raftConfig.getPeerAddressResolver());
     }
 
     public static Builder newBuilder() {
@@ -178,6 +179,10 @@ public class DatastoreContext {
         return transactionCreationInitialRateLimit;
     }
 
+    private void setPeerAddressResolver(PeerAddressResolver resolver) {
+        raftConfig.setPeerAddressResolver(resolver);
+    }
+
     private void setHeartbeatInterval(long shardHeartbeatIntervalInMillis){
         raftConfig.setHeartBeatInterval(new FiniteDuration(shardHeartbeatIntervalInMillis,
                 TimeUnit.MILLISECONDS));
@@ -201,7 +206,6 @@ public class DatastoreContext {
         raftConfig.setCustomRaftPolicyImplementationClass(customRaftPolicyImplementation);
     }
 
-
     private void setSnapshotDataThresholdPercentage(int shardSnapshotDataThresholdPercentage) {
         raftConfig.setSnapshotDataThresholdPercentage(shardSnapshotDataThresholdPercentage);
     }
@@ -210,6 +214,10 @@ public class DatastoreContext {
         raftConfig.setSnapshotBatchCount(shardSnapshotBatchCount);
     }
 
+    private void setShardSnapshotChunkSize(int shardSnapshotChunkSize) {
+        raftConfig.setSnapshotChunkSize(shardSnapshotChunkSize);
+    }
+
     public int getShardBatchedModificationCount() {
         return shardBatchedModificationCount;
     }
@@ -230,10 +238,6 @@ public class DatastoreContext {
         return raftConfig.getSnapshotChunkSize();
     }
 
-    public void setShardSnapshotChunkSize(int shardSnapshotChunkSize) {
-        raftConfig.setSnapshotChunkSize(shardSnapshotChunkSize);
-    }
-
     public static class Builder {
         private final DatastoreContext datastoreContext;
         private int maxShardDataChangeExecutorPoolSize =
@@ -441,5 +445,10 @@ public class DatastoreContext {
             datastoreContext.setShardSnapshotChunkSize(shardSnapshotChunkSize);
             return this;
         }
+
+        public Builder shardPeerAddressResolver(PeerAddressResolver resolver) {
+            datastoreContext.setPeerAddressResolver(resolver);
+            return this;
+        }
     }
 }