BUG-5280: add frontend state lifecycle
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DatastoreContext.java
index a81806bc1086b66ff4400ced5e6d5355dc2be30a..eeb6ad3155e2bc91d9e910728d589cca2084603b 100644 (file)
@@ -76,6 +76,7 @@ public class DatastoreContext {
     private int shardBatchedModificationCount = DEFAULT_SHARD_BATCHED_MODIFICATION_COUNT;
     private boolean writeOnlyTransactionOptimizationsEnabled = true;
     private long shardCommitQueueExpiryTimeoutInMillis = DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS;
+    private boolean useTellBasedProtocol = false;
     private boolean transactionDebugContextEnabled = false;
     private String shardManagerPersistenceId;
 
@@ -113,6 +114,7 @@ public class DatastoreContext {
         this.shardCommitQueueExpiryTimeoutInMillis = other.shardCommitQueueExpiryTimeoutInMillis;
         this.transactionDebugContextEnabled = other.transactionDebugContextEnabled;
         this.shardManagerPersistenceId = other.shardManagerPersistenceId;
+        this.useTellBasedProtocol = other.useTellBasedProtocol;
 
         setShardJournalRecoveryLogBatchSize(other.raftConfig.getJournalRecoveryLogBatchSize());
         setSnapshotBatchCount(other.raftConfig.getSnapshotBatchCount());
@@ -123,6 +125,8 @@ public class DatastoreContext {
         setCustomRaftPolicyImplementation(other.raftConfig.getCustomRaftPolicyImplementationClass());
         setShardSnapshotChunkSize(other.raftConfig.getSnapshotChunkSize());
         setPeerAddressResolver(other.raftConfig.getPeerAddressResolver());
+        setTempFileDirectory(other.getTempFileDirectory());
+        setFileBackedStreamingThreshold(other.getFileBackedStreamingThreshold());
     }
 
     public static Builder newBuilder() {
@@ -201,6 +205,22 @@ public class DatastoreContext {
         return shardManagerPersistenceId;
     }
 
+    public String getTempFileDirectory() {
+        return raftConfig.getTempFileDirectory();
+    }
+
+    private void setTempFileDirectory(String tempFileDirectory) {
+        raftConfig.setTempFileDirectory(tempFileDirectory);
+    }
+
+    public int getFileBackedStreamingThreshold() {
+        return raftConfig.getFileBackedStreamingThreshold();
+    }
+
+    private void setFileBackedStreamingThreshold(int fileBackedStreamingThreshold) {
+        raftConfig.setFileBackedStreamingThreshold(fileBackedStreamingThreshold);
+    }
+
     private void setPeerAddressResolver(PeerAddressResolver resolver) {
         raftConfig.setPeerAddressResolver(resolver);
     }
@@ -258,6 +278,10 @@ public class DatastoreContext {
         return transactionDebugContextEnabled;
     }
 
+    public boolean isUseTellBasedProtocol() {
+        return useTellBasedProtocol;
+    }
+
     public int getShardSnapshotChunkSize() {
         return raftConfig.getSnapshotChunkSize();
     }
@@ -471,6 +495,11 @@ public class DatastoreContext {
             return this;
         }
 
+        public Builder useTellBasedProtocol(boolean value) {
+            datastoreContext.useTellBasedProtocol = value;
+            return this;
+        }
+
         /**
          * For unit tests only.
          */
@@ -506,5 +535,15 @@ public class DatastoreContext {
             datastoreContext.setPeerAddressResolver(resolver);
             return this;
         }
+
+        public Builder tempFileDirectory(String tempFileDirectory) {
+            datastoreContext.setTempFileDirectory(tempFileDirectory);
+            return this;
+        }
+
+        public Builder fileBackedStreamingThresholdInMegabytes(int  fileBackedStreamingThreshold) {
+            datastoreContext.setFileBackedStreamingThreshold(fileBackedStreamingThreshold * ConfigParams.MEGABYTE);
+            return this;
+        }
     }
 }