Make Raft messages serializable 00/9300/8
authorKamal Rameshan <kramesha@cisco.com>
Thu, 24 Jul 2014 20:21:52 +0000 (13:21 -0700)
committerMoiz Raja <moraja@cisco.com>
Tue, 29 Jul 2014 22:11:35 +0000 (15:11 -0700)
- Make AppendEntries a protocol buffer message
- Create the Payload extension mechanism to be used for AppendEntries by extensions
  of RaftActors to define their custom Payloads
- Modified tests etc as appropriate

Change-Id: I2d5af41b7ca8ad7a8b94515ebc5adaa78803ad15
Signed-off-by: Kamal Rameshan <kramesha@cisco.com>
Signed-off-by: Moiz Raja <moraja@cisco.com>
49 files changed:
opendaylight/commons/opendaylight/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-akka-raft/README-FIRST [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/pom.xml
opendaylight/md-sal/sal-akka-raft/run.sh [new file with mode: 0755]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValueSaved.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintRole.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SerializationUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/ApplySnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/ApplyState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/CommitEntry.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/ElectionTimeout.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/PersistEntry.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/Replicate.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/SaveSnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/SendHeartBeat.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/internal/messages/SendInstallSnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AbstractRaftRPC.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVote.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVoteReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/application.conf
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehaviorTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf

index d6c65a4..be88e4a 100644 (file)
           <includeTestSourceDirectory>true</includeTestSourceDirectory>
           <sourceDirectory>${project.basedir}</sourceDirectory>
           <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
-          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/</excludes>
+          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/,**\/protobuff\/</excludes>
         </configuration>
         <dependencies>
           <dependency>
index 2cddbbf..51e852e 100644 (file)
@@ -58,6 +58,8 @@
     <!-- Documentation -->
     <module>sal-rest-docgen</module>
 
+    <module>sal-akka-raft</module>
+
     <!--InMemory DOM DataStore-->
     <module>sal-inmemory-datastore</module>
 
diff --git a/opendaylight/md-sal/sal-akka-raft/README-FIRST b/opendaylight/md-sal/sal-akka-raft/README-FIRST
new file mode 100644 (file)
index 0000000..d0be2cb
--- /dev/null
@@ -0,0 +1,28 @@
+Instructions on generating the protocol buffer Java source files
+
+These instructions are developers who are planning to generate the protocolbuffer java source files.
+
+1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
+The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
+your OS.
+
+2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
+machine
+
+3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
+   get generation in proper packages. For more information  check
+   https://developers.google.com/protocol-buffers/docs/javatutorial
+
+   For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
+
+4. To generate the java source files execute in sal-protocolbuffer-encoding directory
+   just run.sh in sal-protocolbuffer-encoding or execute the following command
+
+ protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+
+5. Run mvn clean install  & build the .jar
+
+6. !!!WARNING!!! - never edit the generated sources files of protocol buffer
+
+7. !!!NOTE!!! if you are planning to add new .proto file  option java_package should begin with
+   org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
index 50442bd..3dcc546 100644 (file)
   <packaging>bundle</packaging>
 
   <dependencies>
+    <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+      <version>2.5.0</version>
+    </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
           </execution>
         </executions>
       </plugin>
+
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
           </execution>
         </executions>
       </plugin>
+
+     <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+            <excludes>**/protobuff/**/*</excludes>
+        </configuration>
+      </plugin>
+
     </plugins>
   </build>
   <scm>
diff --git a/opendaylight/md-sal/sal-akka-raft/run.sh b/opendaylight/md-sal/sal-akka-raft/run.sh
new file mode 100755 (executable)
index 0000000..7c588f0
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+#####################################################################################################
+#Instructions on generating the protocol buffer Java source files
+#
+#These instructions are developers who are planning to generate the protocolbuffer java source files.
+#
+#1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
+#The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
+#your OS.
+#
+#2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
+#machine
+#
+#3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
+#   get generation in proper packages. For more information  check
+#   https://developers.google.com/protocol-buffers/docs/javatutorial
+#
+#   For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
+#
+#4. To generate the java source files execute in sal-protocolbuffer-encoding execute ./run.sh i.e. this script
+# or run command
+#       protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+#
+#5. Run mvn clean install & build the .jar
+#
+#6  !!!WARNING!!!! never edit the source files generated
+#
+#7. !!!NOTE!!! if you are planning to add new .proto file  option java_package should begin with
+#   org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
+########################################################################################################
+
+protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+
+protoc --proto_path=src/main/resources --proto_path=src/test/resources --java_out=src/test/java src/test/resources/*.proto
+
+echo "Done generating Java source files."
+
+#to remove trailing spaces in the code files
+find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
+
+find src/test/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
index 8d4d5e4..641ec05 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
 import org.opendaylight.controller.cluster.example.messages.PrintRole;
 import org.opendaylight.controller.cluster.example.messages.PrintState;
 import org.opendaylight.controller.cluster.raft.RaftActor;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -45,10 +46,9 @@ public class ExampleActor extends RaftActor {
 
     @Override public void onReceiveCommand(Object message){
         if(message instanceof KeyValue){
-
             if(isLeader()) {
                 String persistId = Long.toString(persistIdentifier++);
-                persistData(getSender(), persistId, message);
+                persistData(getSender(), persistId, (Payload) message);
             } else {
                 if(getLeader() != null) {
                     getLeader().forward(message, getContext());
@@ -56,12 +56,13 @@ public class ExampleActor extends RaftActor {
             }
 
         } else if (message instanceof PrintState) {
-            LOG.debug("State of the node:"+getId() + " is="+state.size());
+            LOG.debug("State of the node:"+getId() + " has = "+state.size() + " entries");
 
         } else if (message instanceof PrintRole) {
             LOG.debug(getId() + " = " + getRaftState());
+        } else {
+            super.onReceiveCommand(message);
         }
-        super.onReceiveCommand(message);
     }
 
     @Override protected void applyState(ActorRef clientActor, String identifier,
index c8a7835..c2d0b3a 100644 (file)
@@ -14,7 +14,12 @@ import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.ConcurrentHashMap;
 
-
+/**
+ * This is a test driver for testing akka-raft implementation
+ * Its uses ExampleActors and threads to push content(key-vals) to these actors
+ * Each ExampleActor can have one or more ClientActors. Each ClientActor spawns
+ * a thread and starts push logs to the actor its assignged to.
+ */
 public class TestDriver {
 
     private static final ActorSystem actorSystem = ActorSystem.create();
index 00cc09a..560d5fc 100644 (file)
@@ -8,11 +8,21 @@
 
 package org.opendaylight.controller.cluster.example.messages;
 
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class KeyValue extends Payload implements Serializable {
+    private String key;
+    private String value;
 
-public class KeyValue implements Serializable{
-    private final String key;
-    private final String value;
+    public KeyValue() {
+    }
 
     public KeyValue(String key, String value){
         this.key = key;
@@ -27,10 +37,37 @@ public class KeyValue implements Serializable{
         return value;
     }
 
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
     @Override public String toString() {
         return "KeyValue{" +
             "key='" + key + '\'' +
             ", value='" + value + '\'' +
             '}';
     }
+
+    // override this method to return  the protobuff related extension fields and their values
+    @Override public Map<GeneratedMessage.GeneratedExtension, String> encode() {
+        Map<GeneratedMessage.GeneratedExtension, String> map = new HashMap<>();
+        map.put(KeyValueMessages.key, getKey());
+        map.put(KeyValueMessages.value, getValue());
+        return map;
+    }
+
+    // override this method to assign the values from protobuff
+    @Override public Payload decode(
+        AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) {
+        String key = payloadProtoBuff.getExtension(KeyValueMessages.key);
+        String value = payloadProtoBuff.getExtension(KeyValueMessages.value);
+        this.setKey(key);
+        this.setValue(value);
+        return this;
+    }
+
 }
index c9d4bfa..a5105f0 100644 (file)
@@ -1,7 +1,14 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.cluster.example.messages;
 
-/**
- * Created by kramesha on 7/17/14.
- */
-public class PrintRole {
+import java.io.Serializable;
+
+public class PrintRole implements Serializable {
 }
index dbf863d..20ed142 100644 (file)
@@ -1,7 +1,14 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.cluster.example.messages;
 
-/**
- * Created by kramesha on 7/17/14.
- */
-public class PrintState {
+import java.io.Serializable;
+
+public class PrintState implements Serializable {
 }
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java
new file mode 100644 (file)
index 0000000..c3d4bbf
--- /dev/null
@@ -0,0 +1,73 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: KeyValueMessages.proto
+
+package org.opendaylight.controller.cluster.example.protobuff.messages;
+
+public final class KeyValueMessages {
+  private KeyValueMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+    registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.key);
+    registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.value);
+  }
+  public static final int KEY_FIELD_NUMBER = 2;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      java.lang.String> key = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        java.lang.String.class,
+        null);
+  public static final int VALUE_FIELD_NUMBER = 3;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      java.lang.String> value = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        java.lang.String.class,
+        null);
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\026KeyValueMessages.proto\022(org.opendaylig" +
+      "ht.controller.cluster.raft\032\033AppendEntrie" +
+      "sMessages.proto:_\n\003key\022R.org.opendayligh" +
+      "t.controller.cluster.raft.AppendEntries." +
+      "ReplicatedLogEntry.Payload\030\002 \001(\t:a\n\005valu" +
+      "e\022R.org.opendaylight.controller.cluster." +
+      "raft.AppendEntries.ReplicatedLogEntry.Pa" +
+      "yload\030\003 \001(\tBT\n>org.opendaylight.controll" +
+      "er.cluster.example.protobuff.messagesB\020K" +
+      "eyValueMessagesH\001"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          key.internalInit(descriptor.getExtensions().get(0));
+          value.internalInit(descriptor.getExtensions().get(1));
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
index 0ff2341..1523979 100644 (file)
@@ -30,6 +30,7 @@ import org.opendaylight.controller.cluster.raft.internal.messages.ApplySnapshot;
 import org.opendaylight.controller.cluster.raft.client.messages.RemoveRaftPeer;
 import org.opendaylight.controller.cluster.raft.internal.messages.ApplyState;
 import org.opendaylight.controller.cluster.raft.internal.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -141,14 +142,17 @@ public abstract class RaftActor extends UntypedPersistentActor {
 
             applyState(applyState.getClientActor(), applyState.getIdentifier(),
                 applyState.getReplicatedLogEntry().getData());
+
         } else if(message instanceof ApplySnapshot ) {
             applySnapshot(((ApplySnapshot) message).getSnapshot());
+
         } else if (message instanceof FindLeader) {
             getSender().tell(
                 new FindLeaderReply(
                     context.getPeerAddress(currentBehavior.getLeaderId())),
                 getSelf()
             );
+
         } else if (message instanceof SaveSnapshotSuccess) {
             SaveSnapshotSuccess success = (SaveSnapshotSuccess) message;
 
@@ -158,7 +162,12 @@ public abstract class RaftActor extends UntypedPersistentActor {
         } else if (message instanceof SaveSnapshotFailure) {
 
             // TODO: Handle failure in saving the snapshot
-            // Maybe do retries on failure
+
+        } else if (message instanceof FindLeader){
+
+            getSender().tell(new FindLeaderReply(
+                context.getPeerAddress(currentBehavior.getLeaderId())),
+                getSelf());
 
         } else if (message instanceof AddRaftPeer){
 
@@ -193,7 +202,7 @@ public abstract class RaftActor extends UntypedPersistentActor {
      * @param data
      */
     protected void persistData(ActorRef clientActor, String identifier,
-        Object data) {
+        Payload data) {
 
         ReplicatedLogEntry replicatedLogEntry = new ReplicatedLogImplEntry(
             context.getReplicatedLog().lastIndex() + 1,
@@ -520,39 +529,7 @@ public abstract class RaftActor extends UntypedPersistentActor {
     }
 
 
-    private static class ReplicatedLogImplEntry implements ReplicatedLogEntry,
-        Serializable {
-
-        private final long index;
-        private final long term;
-        private final Object payload;
-
-        public ReplicatedLogImplEntry(long index, long term, Object payload) {
-
-            this.index = index;
-            this.term = term;
-            this.payload = payload;
-        }
 
-        @Override public Object getData() {
-            return payload;
-        }
-
-        @Override public long getTerm() {
-            return term;
-        }
-
-        @Override public long getIndex() {
-            return index;
-        }
-
-        @Override public String toString() {
-            return "Entry{" +
-                "index=" + index +
-                ", term=" + term +
-                '}';
-        }
-    }
 
     private static class DeleteEntries implements Serializable {
         private final int fromIndex;
index 3bbaa22..f501c4d 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.controller.cluster.raft;
 
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
 /**
  * Represents one entry in the replicated log
  */
@@ -17,7 +19,7 @@ public interface ReplicatedLogEntry {
      *
      * @return
      */
-    Object getData();
+    Payload getData();
 
     /**
      * The term stored in that entry
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java
new file mode 100644 (file)
index 0000000..fc2ec5c
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft;
+
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+import java.io.Serializable;
+
+public class ReplicatedLogImplEntry implements ReplicatedLogEntry,
+    Serializable {
+
+    private final long index;
+    private final long term;
+    private final Payload payload;
+
+    public ReplicatedLogImplEntry(long index, long term, Payload payload) {
+
+        this.index = index;
+        this.term = term;
+        this.payload = payload;
+    }
+
+    @Override public Payload getData() {
+        return payload;
+    }
+
+    @Override public long getTerm() {
+        return term;
+    }
+
+    @Override public long getIndex() {
+        return index;
+    }
+
+    @Override public String toString() {
+        return "Entry{" +
+            "index=" + index +
+            ", term=" + term +
+            '}';
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SerializationUtils.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SerializationUtils.java
new file mode 100644 (file)
index 0000000..374e0fa
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft;
+
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+
+public class SerializationUtils {
+
+    public static Object fromSerializable(Object serializable){
+        if(serializable.getClass().equals(AppendEntries.SERIALIZABLE_CLASS)){
+            return AppendEntries.fromSerializable(serializable);
+        }
+        return serializable;
+    }
+
+}
index 1d78bb0..bc87370 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.cluster.raft.ClientRequestTracker;
 import org.opendaylight.controller.cluster.raft.RaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.SerializationUtils;
 import org.opendaylight.controller.cluster.raft.internal.messages.ApplyState;
 import org.opendaylight.controller.cluster.raft.internal.messages.ElectionTimeout;
 import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
@@ -349,6 +350,10 @@ public abstract class AbstractRaftActorBehavior implements RaftActorBehavior {
         context.setLastApplied(index);
     }
 
+    protected Object fromSerializableMessage(Object serializable){
+        return SerializationUtils.fromSerializable(serializable);
+    }
+
     @Override
     public RaftState handleMessage(ActorRef sender, Object message) {
         if (message instanceof AppendEntries) {
index 532201b..68b444b 100644 (file)
@@ -214,7 +214,10 @@ public class Follower extends AbstractRaftActorBehavior {
         return RaftState.Follower;
     }
 
-    @Override public RaftState handleMessage(ActorRef sender, Object message) {
+    @Override public RaftState handleMessage(ActorRef sender, Object originalMessage) {
+
+        Object message = fromSerializableMessage(originalMessage);
+
         if (message instanceof RaftRPC) {
             RaftRPC rpc = (RaftRPC) message;
             // If RPC request or response contains term T > currentTerm:
@@ -227,9 +230,10 @@ public class Follower extends AbstractRaftActorBehavior {
 
         if (message instanceof ElectionTimeout) {
             return RaftState.Candidate;
+
         } else if (message instanceof InstallSnapshot) {
-            InstallSnapshot snapshot = (InstallSnapshot) message;
-            actor().tell(new ApplySnapshot(snapshot), actor());
+            InstallSnapshot installSnapshot = (InstallSnapshot) message;
+            actor().tell(new ApplySnapshot(installSnapshot.getData()), actor());
         }
 
         scheduleElection(electionDuration());
index fb8be8b..26beed2 100644 (file)
@@ -200,9 +200,11 @@ public class Leader extends AbstractRaftActorBehavior {
         return RaftState.Leader;
     }
 
-    @Override public RaftState handleMessage(ActorRef sender, Object message) {
+    @Override public RaftState handleMessage(ActorRef sender, Object originalMessage) {
         Preconditions.checkNotNull(sender, "sender should not be null");
 
+        Object message = fromSerializableMessage(originalMessage);
+
         if (message instanceof RaftRPC) {
             RaftRPC rpc = (RaftRPC) message;
             // If RPC request or response contains term T > currentTerm:
@@ -298,12 +300,9 @@ public class Leader extends AbstractRaftActorBehavior {
             }
 
             followerActor.tell(
-                new AppendEntries(currentTerm(), context.getId(),
-                    prevLogIndex(nextIndex), prevLogTerm(nextIndex),
-                    entries, context.getCommitIndex()
-                ),
-                actor()
-            );
+                new AppendEntries(currentTerm(), context.getId(), prevLogIndex(nextIndex),
+                    prevLogTerm(nextIndex), entries, context.getCommitIndex()).toSerializable(),
+                actor());
         }
     }
 
index a7172e2..f9c7c13 100644 (file)
@@ -8,7 +8,9 @@
 
 package org.opendaylight.controller.cluster.raft.internal.messages;
 
-public class ApplySnapshot {
+import java.io.Serializable;
+
+public class ApplySnapshot implements Serializable {
     private final Object snapshot;
 
     public ApplySnapshot(Object snapshot) {
index c9ba26e..f58d748 100644 (file)
@@ -11,7 +11,9 @@ package org.opendaylight.controller.cluster.raft.internal.messages;
 import akka.actor.ActorRef;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 
-public class ApplyState {
+import java.io.Serializable;
+
+public class ApplyState implements Serializable {
     private final ActorRef clientActor;
     private final String identifier;
     private final ReplicatedLogEntry replicatedLogEntry;
index 7afe0b5..fe0dcc5 100644 (file)
@@ -8,8 +8,10 @@
 
 package org.opendaylight.controller.cluster.raft.internal.messages;
 
+import java.io.Serializable;
+
 /**
  * Message sent to Persist an entry into the transaction journal
  */
-public class PersistEntry {
+public class PersistEntry implements Serializable {
 }
index 6ff7cfc..e9cdcf0 100644 (file)
@@ -11,7 +11,9 @@ package org.opendaylight.controller.cluster.raft.internal.messages;
 import akka.actor.ActorRef;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 
-public class Replicate {
+import java.io.Serializable;
+
+public class Replicate implements Serializable {
     private final ActorRef clientActor;
     private final String identifier;
     private final ReplicatedLogEntry replicatedLogEntry;
index 20e5927..ce0ad1f 100644 (file)
@@ -8,9 +8,11 @@
 
 package org.opendaylight.controller.cluster.raft.internal.messages;
 
+import java.io.Serializable;
+
 /**
  * This message is sent by a RaftActor to itself so that a subclass can process
  * it and use it to save it's state
  */
-public class SaveSnapshot {
+public class SaveSnapshot implements Serializable {
 }
index 5048cbb..1555766 100644 (file)
@@ -8,11 +8,13 @@
 
 package org.opendaylight.controller.cluster.raft.internal.messages;
 
+import java.io.Serializable;
+
 /**
  * This messages is sent to the Leader to prompt it to send a heartbeat
  * to it's followers.
  *
  * Typically the Leader to itself on a schedule
  */
-public class SendHeartBeat {
+public class SendHeartBeat implements Serializable {
 }
index 3cafda9..33d8a68 100644 (file)
@@ -16,9 +16,15 @@ public class AbstractRaftRPC implements RaftRPC {
         this.term = term;
     }
 
+    // added for testing while serialize-messages=on
+    public AbstractRaftRPC() {
+    }
+
     public long getTerm() {
         return term;
     }
 
-
+    public void setTerm(long term) {
+        this.term = term;
+    }
 }
index 9bb5029..45ac9a9 100644 (file)
@@ -8,15 +8,28 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
+import com.google.protobuf.GeneratedMessage;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Invoked by leader to replicate log entries (§5.3); also used as
  * heartbeat (§5.2).
  */
-public class AppendEntries extends AbstractRaftRPC {
+public class AppendEntries extends AbstractRaftRPC implements Serializable {
+
+    public static final Class SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class;
+
+    private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(AppendEntries.class);
+
     // So that follower can redirect clients
     private final String leaderId;
 
@@ -72,4 +85,77 @@ public class AppendEntries extends AbstractRaftRPC {
             ", leaderCommit=" + leaderCommit +
             '}';
     }
+
+    public <T extends Object> Object toSerializable(){
+        AppendEntriesMessages.AppendEntries.Builder to = AppendEntriesMessages.AppendEntries.newBuilder();
+        to.setTerm(this.getTerm())
+            .setLeaderId(this.getLeaderId())
+            .setPrevLogTerm(this.getPrevLogTerm())
+            .setPrevLogIndex(this.getPrevLogIndex())
+            .setLeaderCommit(this.getLeaderCommit());
+
+        for (ReplicatedLogEntry logEntry : this.getEntries()) {
+
+            AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder arBuilder =
+                AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder();
+
+            AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder arpBuilder =
+                AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder();
+
+            //get the client specific payload extensions and add them to the payload builder
+            Map<GeneratedMessage.GeneratedExtension, T> map = logEntry.getData().encode();
+            Iterator<Map.Entry<GeneratedMessage.GeneratedExtension, T>> iter = map.entrySet().iterator();
+
+            while (iter.hasNext()) {
+                Map.Entry<GeneratedMessage.GeneratedExtension, T> entry = iter.next();
+                arpBuilder.setExtension(entry.getKey(), entry.getValue());
+            }
+
+            arpBuilder.setClientPayloadClassName(logEntry.getData().getClientPayloadClassName());
+
+            arBuilder.setData(arpBuilder).setIndex(logEntry.getIndex()).setTerm(logEntry.getTerm());
+            to.addLogEntries(arBuilder);
+        }
+
+        return to.build();
+    }
+
+    public static AppendEntries fromSerializable(Object o){
+        AppendEntriesMessages.AppendEntries from = (AppendEntriesMessages.AppendEntries) o;
+
+        List<ReplicatedLogEntry> logEntryList = new ArrayList<>();
+        for (AppendEntriesMessages.AppendEntries.ReplicatedLogEntry leProtoBuff : from.getLogEntriesList()) {
+
+            Payload payload = null ;
+            try {
+                if(leProtoBuff.getData() != null && leProtoBuff.getData().getClientPayloadClassName() != null) {
+                    String clientPayloadClassName = leProtoBuff.getData().getClientPayloadClassName();
+                    payload = (Payload)Class.forName(clientPayloadClassName).newInstance();
+                    payload = payload.decode(leProtoBuff.getData());
+                    payload.setClientPayloadClassName(clientPayloadClassName);
+                } else {
+                    LOG.error("Payload is null or payload does not have client payload class name");
+                }
+
+            } catch (InstantiationException e) {
+                LOG.error("InstantiationException when instantiating "+leProtoBuff.getData().getClientPayloadClassName(), e);
+            } catch (IllegalAccessException e) {
+                LOG.error("IllegalAccessException when accessing "+leProtoBuff.getData().getClientPayloadClassName(), e);
+            } catch (ClassNotFoundException e) {
+                LOG.error("ClassNotFoundException when loading "+leProtoBuff.getData().getClientPayloadClassName(), e);
+            }
+            ReplicatedLogEntry logEntry = new ReplicatedLogImplEntry(
+                leProtoBuff.getIndex(), leProtoBuff.getTerm(), payload);
+            logEntryList.add(logEntry);
+        }
+
+        AppendEntries to = new AppendEntries(from.getTerm(),
+            from.getLeaderId(),
+            from.getPrevLogIndex(),
+            from.getPrevLogTerm(),
+            logEntryList,
+            from.getLeaderCommit());
+
+        return to;
+    }
 }
index 7524d8f..7e6628a 100644 (file)
@@ -8,10 +8,12 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
+import java.io.Serializable;
+
 /**
  * Reply for the AppendEntriesRpc message
  */
-public class AppendEntriesReply extends AbstractRaftRPC{
+public class AppendEntriesReply extends AbstractRaftRPC implements Serializable {
 
     // true if follower contained entry matching
     // prevLogIndex and prevLogTerm
index 888854f..5053560 100644 (file)
@@ -8,7 +8,9 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
-public class InstallSnapshot extends AbstractRaftRPC {
+import java.io.Serializable;
+
+public class InstallSnapshot extends AbstractRaftRPC implements Serializable {
 
     private final String leaderId;
     private final long lastIncludedIndex;
index 85b89b7..02a3252 100644 (file)
@@ -8,7 +8,9 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
-public class InstallSnapshotReply extends AbstractRaftRPC {
+import java.io.Serializable;
+
+public class InstallSnapshotReply extends AbstractRaftRPC implements Serializable {
 
     // The followerId - this will be used to figure out which follower is
     // responding
index 981da17..310968d 100644 (file)
@@ -8,19 +8,21 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
+import java.io.Serializable;
+
 /**
  * Invoked by candidates to gather votes (§5.2).
  */
-public class RequestVote extends AbstractRaftRPC{
+public class RequestVote extends AbstractRaftRPC implements Serializable{
 
     // candidate requesting vote
-    private final String candidateId;
+    private String candidateId;
 
     // index of candidate’s last log entry (§5.4)
-    private final long lastLogIndex;
+    private long lastLogIndex;
 
     // term of candidate’s last log entry (§5.4)
-    private final long lastLogTerm;
+    private long lastLogTerm;
 
     public RequestVote(long term, String candidateId, long lastLogIndex,
         long lastLogTerm) {
@@ -30,6 +32,10 @@ public class RequestVote extends AbstractRaftRPC{
         this.lastLogTerm = lastLogTerm;
     }
 
+    // added for testing while serialize-messages=on
+    public RequestVote() {
+    }
+
     public long getTerm() {
         return term;
     }
@@ -45,4 +51,16 @@ public class RequestVote extends AbstractRaftRPC{
     public long getLastLogTerm() {
         return lastLogTerm;
     }
+
+    public void setCandidateId(String candidateId) {
+        this.candidateId = candidateId;
+    }
+
+    public void setLastLogIndex(long lastLogIndex) {
+        this.lastLogIndex = lastLogIndex;
+    }
+
+    public void setLastLogTerm(long lastLogTerm) {
+        this.lastLogTerm = lastLogTerm;
+    }
 }
index 816120c..a658ab7 100644 (file)
@@ -8,7 +8,9 @@
 
 package org.opendaylight.controller.cluster.raft.messages;
 
-public class RequestVoteReply extends AbstractRaftRPC{
+import java.io.Serializable;
+
+public class RequestVoteReply extends AbstractRaftRPC implements Serializable {
 
     // true means candidate received vot
     private final boolean voteGranted;
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java
new file mode 100644 (file)
index 0000000..9a251cd
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft.protobuff.client.messages;
+
+
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
+import java.util.Map;
+
+/**
+ * An instance of a Payload class is meant to be used as the Payload for
+ * AppendEntries.
+ * <p>
+ *
+ * When an actor which is derived from RaftActor attempts to persistData it
+ * must pass an instance of the Payload class. Similarly when state needs to
+ * be applied to the derived RaftActor it will be passed an instance of the
+ * Payload class.
+ * <p>
+ *
+ * To define your own payload do the following,
+ * <ol>
+ *     <li>Create your own protocol buffer message which extends the AppendEntries Payload</li>
+ *     <li>Extend this Payload class</li>
+ *     <li>Implement encode</li>
+ *     <li>Implement decode</li>
+ * </ol>
+ *
+ * Your own protocol buffer message can be create like so, <br/>
+ * <pre>
+ * {@code
+ *
+ * import "AppendEntriesMessages.proto";
+ *
+ * package org.opendaylight.controller.cluster.raft;
+ *
+ * option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+ * option java_outer_classname = "MockPayloadMessages";
+ *
+ * extend AppendEntries.ReplicatedLogEntry.Payload {
+ *      optional string value = 2;
+ * }
+ * }
+ * </pre>
+ *
+ */
+public abstract class Payload {
+    private String clientPayloadClassName;
+
+    public String getClientPayloadClassName() {
+        return this.getClass().getName();
+    }
+
+    public void setClientPayloadClassName(String clientPayloadClassName) {
+        this.clientPayloadClassName = clientPayloadClassName;
+    }
+
+    /**
+     * Encode the payload data as a protocol buffer extension.
+     * <p>
+     * TODO: Add more meat in here
+     * @param <T>
+     * @return Map of <GeneratedMessage.GeneratedExtension, T>
+     */
+    public abstract <T extends Object> Map<GeneratedMessage.GeneratedExtension, T> encode();
+
+    /**
+     * Decode the protocol buffer payload into a specific Payload as defined
+     * by the class extending RaftActor
+     *
+     * @param payload The payload in protocol buffer format
+     * @return
+     */
+    public abstract Payload decode(
+        AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payload);
+
+
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java
new file mode 100644 (file)
index 0000000..00aeaf2
--- /dev/null
@@ -0,0 +1,2420 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: AppendEntriesMessages.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class AppendEntriesMessages {
+  private AppendEntriesMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface AppendEntriesOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional int64 term = 1;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    boolean hasTerm();
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    long getTerm();
+
+    // optional string leaderId = 2;
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    boolean hasLeaderId();
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    java.lang.String getLeaderId();
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getLeaderIdBytes();
+
+    // optional int64 prevLogIndex = 3;
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    boolean hasPrevLogIndex();
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    long getPrevLogIndex();
+
+    // optional int64 prevLogTerm = 4;
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    boolean hasPrevLogTerm();
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    long getPrevLogTerm();
+
+    // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> 
+        getLogEntriesList();
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    int getLogEntriesCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+        getLogEntriesOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+        int index);
+
+    // optional int64 leaderCommit = 6;
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    boolean hasLeaderCommit();
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    long getLeaderCommit();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries}
+   */
+  public static final class AppendEntries extends
+      com.google.protobuf.GeneratedMessage
+      implements AppendEntriesOrBuilder {
+    // Use AppendEntries.newBuilder() to construct.
+    private AppendEntries(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private AppendEntries(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final AppendEntries defaultInstance;
+    public static AppendEntries getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public AppendEntries getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private AppendEntries(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              term_ = input.readInt64();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              leaderId_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              prevLogIndex_ = input.readInt64();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              prevLogTerm_ = input.readInt64();
+              break;
+            }
+            case 42: {
+              if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+                logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>();
+                mutable_bitField0_ |= 0x00000010;
+              }
+              logEntries_.add(input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PARSER, extensionRegistry));
+              break;
+            }
+            case 48: {
+              bitField0_ |= 0x00000010;
+              leaderCommit_ = input.readInt64();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+          logEntries_ = java.util.Collections.unmodifiableList(logEntries_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<AppendEntries> PARSER =
+        new com.google.protobuf.AbstractParser<AppendEntries>() {
+      public AppendEntries parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new AppendEntries(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<AppendEntries> getParserForType() {
+      return PARSER;
+    }
+
+    public interface ReplicatedLogEntryOrBuilder
+        extends com.google.protobuf.MessageOrBuilder {
+
+      // optional int64 term = 1;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      boolean hasTerm();
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      long getTerm();
+
+      // optional int64 index = 2;
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      boolean hasIndex();
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      long getIndex();
+
+      // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      boolean hasData();
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData();
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder();
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
+     */
+    public static final class ReplicatedLogEntry extends
+        com.google.protobuf.GeneratedMessage
+        implements ReplicatedLogEntryOrBuilder {
+      // Use ReplicatedLogEntry.newBuilder() to construct.
+      private ReplicatedLogEntry(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+        super(builder);
+        this.unknownFields = builder.getUnknownFields();
+      }
+      private ReplicatedLogEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+      private static final ReplicatedLogEntry defaultInstance;
+      public static ReplicatedLogEntry getDefaultInstance() {
+        return defaultInstance;
+      }
+
+      public ReplicatedLogEntry getDefaultInstanceForType() {
+        return defaultInstance;
+      }
+
+      private final com.google.protobuf.UnknownFieldSet unknownFields;
+      @java.lang.Override
+      public final com.google.protobuf.UnknownFieldSet
+          getUnknownFields() {
+        return this.unknownFields;
+      }
+      private ReplicatedLogEntry(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        initFields();
+        int mutable_bitField0_ = 0;
+        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+            com.google.protobuf.UnknownFieldSet.newBuilder();
+        try {
+          boolean done = false;
+          while (!done) {
+            int tag = input.readTag();
+            switch (tag) {
+              case 0:
+                done = true;
+                break;
+              default: {
+                if (!parseUnknownField(input, unknownFields,
+                                       extensionRegistry, tag)) {
+                  done = true;
+                }
+                break;
+              }
+              case 8: {
+                bitField0_ |= 0x00000001;
+                term_ = input.readInt64();
+                break;
+              }
+              case 16: {
+                bitField0_ |= 0x00000002;
+                index_ = input.readInt64();
+                break;
+              }
+              case 26: {
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder subBuilder = null;
+                if (((bitField0_ & 0x00000004) == 0x00000004)) {
+                  subBuilder = data_.toBuilder();
+                }
+                data_ = input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.PARSER, extensionRegistry);
+                if (subBuilder != null) {
+                  subBuilder.mergeFrom(data_);
+                  data_ = subBuilder.buildPartial();
+                }
+                bitField0_ |= 0x00000004;
+                break;
+              }
+            }
+          }
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          throw e.setUnfinishedMessage(this);
+        } catch (java.io.IOException e) {
+          throw new com.google.protobuf.InvalidProtocolBufferException(
+              e.getMessage()).setUnfinishedMessage(this);
+        } finally {
+          this.unknownFields = unknownFields.build();
+          makeExtensionsImmutable();
+        }
+      }
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+      }
+
+      public static com.google.protobuf.Parser<ReplicatedLogEntry> PARSER =
+          new com.google.protobuf.AbstractParser<ReplicatedLogEntry>() {
+        public ReplicatedLogEntry parsePartialFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return new ReplicatedLogEntry(input, extensionRegistry);
+        }
+      };
+
+      @java.lang.Override
+      public com.google.protobuf.Parser<ReplicatedLogEntry> getParserForType() {
+        return PARSER;
+      }
+
+      public interface PayloadOrBuilder extends
+          com.google.protobuf.GeneratedMessage.
+              ExtendableMessageOrBuilder<Payload> {
+
+        // optional string clientPayloadClassName = 1;
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        boolean hasClientPayloadClassName();
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        java.lang.String getClientPayloadClassName();
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        com.google.protobuf.ByteString
+            getClientPayloadClassNameBytes();
+      }
+      /**
+       * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload}
+       */
+      public static final class Payload extends
+          com.google.protobuf.GeneratedMessage.ExtendableMessage<
+            Payload> implements PayloadOrBuilder {
+        // Use Payload.newBuilder() to construct.
+        private Payload(com.google.protobuf.GeneratedMessage.ExtendableBuilder<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, ?> builder) {
+          super(builder);
+          this.unknownFields = builder.getUnknownFields();
+        }
+        private Payload(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+        private static final Payload defaultInstance;
+        public static Payload getDefaultInstance() {
+          return defaultInstance;
+        }
+
+        public Payload getDefaultInstanceForType() {
+          return defaultInstance;
+        }
+
+        private final com.google.protobuf.UnknownFieldSet unknownFields;
+        @java.lang.Override
+        public final com.google.protobuf.UnknownFieldSet
+            getUnknownFields() {
+          return this.unknownFields;
+        }
+        private Payload(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          initFields();
+          int mutable_bitField0_ = 0;
+          com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+              com.google.protobuf.UnknownFieldSet.newBuilder();
+          try {
+            boolean done = false;
+            while (!done) {
+              int tag = input.readTag();
+              switch (tag) {
+                case 0:
+                  done = true;
+                  break;
+                default: {
+                  if (!parseUnknownField(input, unknownFields,
+                                         extensionRegistry, tag)) {
+                    done = true;
+                  }
+                  break;
+                }
+                case 10: {
+                  bitField0_ |= 0x00000001;
+                  clientPayloadClassName_ = input.readBytes();
+                  break;
+                }
+              }
+            }
+          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+            throw e.setUnfinishedMessage(this);
+          } catch (java.io.IOException e) {
+            throw new com.google.protobuf.InvalidProtocolBufferException(
+                e.getMessage()).setUnfinishedMessage(this);
+          } finally {
+            this.unknownFields = unknownFields.build();
+            makeExtensionsImmutable();
+          }
+        }
+        public static final com.google.protobuf.Descriptors.Descriptor
+            getDescriptor() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+        }
+
+        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+            internalGetFieldAccessorTable() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+              .ensureFieldAccessorsInitialized(
+                  org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+        }
+
+        public static com.google.protobuf.Parser<Payload> PARSER =
+            new com.google.protobuf.AbstractParser<Payload>() {
+          public Payload parsePartialFrom(
+              com.google.protobuf.CodedInputStream input,
+              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+              throws com.google.protobuf.InvalidProtocolBufferException {
+            return new Payload(input, extensionRegistry);
+          }
+        };
+
+        @java.lang.Override
+        public com.google.protobuf.Parser<Payload> getParserForType() {
+          return PARSER;
+        }
+
+        private int bitField0_;
+        // optional string clientPayloadClassName = 1;
+        public static final int CLIENTPAYLOADCLASSNAME_FIELD_NUMBER = 1;
+        private java.lang.Object clientPayloadClassName_;
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        public boolean hasClientPayloadClassName() {
+          return ((bitField0_ & 0x00000001) == 0x00000001);
+        }
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        public java.lang.String getClientPayloadClassName() {
+          java.lang.Object ref = clientPayloadClassName_;
+          if (ref instanceof java.lang.String) {
+            return (java.lang.String) ref;
+          } else {
+            com.google.protobuf.ByteString bs = 
+                (com.google.protobuf.ByteString) ref;
+            java.lang.String s = bs.toStringUtf8();
+            if (bs.isValidUtf8()) {
+              clientPayloadClassName_ = s;
+            }
+            return s;
+          }
+        }
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        public com.google.protobuf.ByteString
+            getClientPayloadClassNameBytes() {
+          java.lang.Object ref = clientPayloadClassName_;
+          if (ref instanceof java.lang.String) {
+            com.google.protobuf.ByteString b = 
+                com.google.protobuf.ByteString.copyFromUtf8(
+                    (java.lang.String) ref);
+            clientPayloadClassName_ = b;
+            return b;
+          } else {
+            return (com.google.protobuf.ByteString) ref;
+          }
+        }
+
+        private void initFields() {
+          clientPayloadClassName_ = "";
+        }
+        private byte memoizedIsInitialized = -1;
+        public final boolean isInitialized() {
+          byte isInitialized = memoizedIsInitialized;
+          if (isInitialized != -1) return isInitialized == 1;
+
+          if (!extensionsAreInitialized()) {
+            memoizedIsInitialized = 0;
+            return false;
+          }
+          memoizedIsInitialized = 1;
+          return true;
+        }
+
+        public void writeTo(com.google.protobuf.CodedOutputStream output)
+                            throws java.io.IOException {
+          getSerializedSize();
+          com.google.protobuf.GeneratedMessage
+            .ExtendableMessage<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload>.ExtensionWriter extensionWriter =
+              newExtensionWriter();
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            output.writeBytes(1, getClientPayloadClassNameBytes());
+          }
+          extensionWriter.writeUntil(101, output);
+          getUnknownFields().writeTo(output);
+        }
+
+        private int memoizedSerializedSize = -1;
+        public int getSerializedSize() {
+          int size = memoizedSerializedSize;
+          if (size != -1) return size;
+
+          size = 0;
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            size += com.google.protobuf.CodedOutputStream
+              .computeBytesSize(1, getClientPayloadClassNameBytes());
+          }
+          size += extensionsSerializedSize();
+          size += getUnknownFields().getSerializedSize();
+          memoizedSerializedSize = size;
+          return size;
+        }
+
+        private static final long serialVersionUID = 0L;
+        @java.lang.Override
+        protected java.lang.Object writeReplace()
+            throws java.io.ObjectStreamException {
+          return super.writeReplace();
+        }
+
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.ByteString data)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.ByteString data,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(byte[] data)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            byte[] data,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(java.io.InputStream input)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            java.io.InputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(java.io.InputStream input)
+            throws java.io.IOException {
+          return PARSER.parseDelimitedFrom(input);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(
+            java.io.InputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          return PARSER.parseDelimitedFrom(input, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.CodedInputStream input)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input, extensionRegistry);
+        }
+
+        public static Builder newBuilder() { return Builder.create(); }
+        public Builder newBuilderForType() { return newBuilder(); }
+        public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload prototype) {
+          return newBuilder().mergeFrom(prototype);
+        }
+        public Builder toBuilder() { return newBuilder(this); }
+
+        @java.lang.Override
+        protected Builder newBuilderForType(
+            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+          Builder builder = new Builder(parent);
+          return builder;
+        }
+        /**
+         * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload}
+         */
+        public static final class Builder extends
+            com.google.protobuf.GeneratedMessage.ExtendableBuilder<
+              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, Builder> implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder {
+          public static final com.google.protobuf.Descriptors.Descriptor
+              getDescriptor() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+          }
+
+          protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+              internalGetFieldAccessorTable() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+                .ensureFieldAccessorsInitialized(
+                    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+          }
+
+          // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder()
+          private Builder() {
+            maybeForceBuilderInitialization();
+          }
+
+          private Builder(
+              com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+            super(parent);
+            maybeForceBuilderInitialization();
+          }
+          private void maybeForceBuilderInitialization() {
+            if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+            }
+          }
+          private static Builder create() {
+            return new Builder();
+          }
+
+          public Builder clear() {
+            super.clear();
+            clientPayloadClassName_ = "";
+            bitField0_ = (bitField0_ & ~0x00000001);
+            return this;
+          }
+
+          public Builder clone() {
+            return create().mergeFrom(buildPartial());
+          }
+
+          public com.google.protobuf.Descriptors.Descriptor
+              getDescriptorForType() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+          }
+
+          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getDefaultInstanceForType() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+          }
+
+          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload build() {
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = buildPartial();
+            if (!result.isInitialized()) {
+              throw newUninitializedMessageException(result);
+            }
+            return result;
+          }
+
+          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload buildPartial() {
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload(this);
+            int from_bitField0_ = bitField0_;
+            int to_bitField0_ = 0;
+            if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+              to_bitField0_ |= 0x00000001;
+            }
+            result.clientPayloadClassName_ = clientPayloadClassName_;
+            result.bitField0_ = to_bitField0_;
+            onBuilt();
+            return result;
+          }
+
+          public Builder mergeFrom(com.google.protobuf.Message other) {
+            if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) {
+              return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload)other);
+            } else {
+              super.mergeFrom(other);
+              return this;
+            }
+          }
+
+          public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload other) {
+            if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) return this;
+            if (other.hasClientPayloadClassName()) {
+              bitField0_ |= 0x00000001;
+              clientPayloadClassName_ = other.clientPayloadClassName_;
+              onChanged();
+            }
+            this.mergeExtensionFields(other);
+            this.mergeUnknownFields(other.getUnknownFields());
+            return this;
+          }
+
+          public final boolean isInitialized() {
+            if (!extensionsAreInitialized()) {
+              
+              return false;
+            }
+            return true;
+          }
+
+          public Builder mergeFrom(
+              com.google.protobuf.CodedInputStream input,
+              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+              throws java.io.IOException {
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parsedMessage = null;
+            try {
+              parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+              parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) e.getUnfinishedMessage();
+              throw e;
+            } finally {
+              if (parsedMessage != null) {
+                mergeFrom(parsedMessage);
+              }
+            }
+            return this;
+          }
+          private int bitField0_;
+
+          // optional string clientPayloadClassName = 1;
+          private java.lang.Object clientPayloadClassName_ = "";
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public boolean hasClientPayloadClassName() {
+            return ((bitField0_ & 0x00000001) == 0x00000001);
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public java.lang.String getClientPayloadClassName() {
+            java.lang.Object ref = clientPayloadClassName_;
+            if (!(ref instanceof java.lang.String)) {
+              java.lang.String s = ((com.google.protobuf.ByteString) ref)
+                  .toStringUtf8();
+              clientPayloadClassName_ = s;
+              return s;
+            } else {
+              return (java.lang.String) ref;
+            }
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public com.google.protobuf.ByteString
+              getClientPayloadClassNameBytes() {
+            java.lang.Object ref = clientPayloadClassName_;
+            if (ref instanceof String) {
+              com.google.protobuf.ByteString b = 
+                  com.google.protobuf.ByteString.copyFromUtf8(
+                      (java.lang.String) ref);
+              clientPayloadClassName_ = b;
+              return b;
+            } else {
+              return (com.google.protobuf.ByteString) ref;
+            }
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public Builder setClientPayloadClassName(
+              java.lang.String value) {
+            if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+            clientPayloadClassName_ = value;
+            onChanged();
+            return this;
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public Builder clearClientPayloadClassName() {
+            bitField0_ = (bitField0_ & ~0x00000001);
+            clientPayloadClassName_ = getDefaultInstance().getClientPayloadClassName();
+            onChanged();
+            return this;
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public Builder setClientPayloadClassNameBytes(
+              com.google.protobuf.ByteString value) {
+            if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+            clientPayloadClassName_ = value;
+            onChanged();
+            return this;
+          }
+
+          // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload)
+        }
+
+        static {
+          defaultInstance = new Payload(true);
+          defaultInstance.initFields();
+        }
+
+        // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload)
+      }
+
+      private int bitField0_;
+      // optional int64 term = 1;
+      public static final int TERM_FIELD_NUMBER = 1;
+      private long term_;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public boolean hasTerm() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public long getTerm() {
+        return term_;
+      }
+
+      // optional int64 index = 2;
+      public static final int INDEX_FIELD_NUMBER = 2;
+      private long index_;
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      public boolean hasIndex() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      public long getIndex() {
+        return index_;
+      }
+
+      // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+      public static final int DATA_FIELD_NUMBER = 3;
+      private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_;
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      public boolean hasData() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+        return data_;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+        return data_;
+      }
+
+      private void initFields() {
+        term_ = 0L;
+        index_ = 0L;
+        data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+      }
+      private byte memoizedIsInitialized = -1;
+      public final boolean isInitialized() {
+        byte isInitialized = memoizedIsInitialized;
+        if (isInitialized != -1) return isInitialized == 1;
+
+        if (hasData()) {
+          if (!getData().isInitialized()) {
+            memoizedIsInitialized = 0;
+            return false;
+          }
+        }
+        memoizedIsInitialized = 1;
+        return true;
+      }
+
+      public void writeTo(com.google.protobuf.CodedOutputStream output)
+                          throws java.io.IOException {
+        getSerializedSize();
+        if (((bitField0_ & 0x00000001) == 0x00000001)) {
+          output.writeInt64(1, term_);
+        }
+        if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          output.writeInt64(2, index_);
+        }
+        if (((bitField0_ & 0x00000004) == 0x00000004)) {
+          output.writeMessage(3, data_);
+        }
+        getUnknownFields().writeTo(output);
+      }
+
+      private int memoizedSerializedSize = -1;
+      public int getSerializedSize() {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+
+        size = 0;
+        if (((bitField0_ & 0x00000001) == 0x00000001)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeInt64Size(1, term_);
+        }
+        if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeInt64Size(2, index_);
+        }
+        if (((bitField0_ & 0x00000004) == 0x00000004)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeMessageSize(3, data_);
+        }
+        size += getUnknownFields().getSerializedSize();
+        memoizedSerializedSize = size;
+        return size;
+      }
+
+      private static final long serialVersionUID = 0L;
+      @java.lang.Override
+      protected java.lang.Object writeReplace()
+          throws java.io.ObjectStreamException {
+        return super.writeReplace();
+      }
+
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.ByteString data)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.ByteString data,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(byte[] data)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          byte[] data,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(java.io.InputStream input)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          java.io.InputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(java.io.InputStream input)
+          throws java.io.IOException {
+        return PARSER.parseDelimitedFrom(input);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(
+          java.io.InputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseDelimitedFrom(input, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.CodedInputStream input)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input, extensionRegistry);
+      }
+
+      public static Builder newBuilder() { return Builder.create(); }
+      public Builder newBuilderForType() { return newBuilder(); }
+      public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry prototype) {
+        return newBuilder().mergeFrom(prototype);
+      }
+      public Builder toBuilder() { return newBuilder(this); }
+
+      @java.lang.Override
+      protected Builder newBuilderForType(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        Builder builder = new Builder(parent);
+        return builder;
+      }
+      /**
+       * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
+       */
+      public static final class Builder extends
+          com.google.protobuf.GeneratedMessage.Builder<Builder>
+         implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder {
+        public static final com.google.protobuf.Descriptors.Descriptor
+            getDescriptor() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+        }
+
+        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+            internalGetFieldAccessorTable() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+              .ensureFieldAccessorsInitialized(
+                  org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+        }
+
+        // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder()
+        private Builder() {
+          maybeForceBuilderInitialization();
+        }
+
+        private Builder(
+            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+          super(parent);
+          maybeForceBuilderInitialization();
+        }
+        private void maybeForceBuilderInitialization() {
+          if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+            getDataFieldBuilder();
+          }
+        }
+        private static Builder create() {
+          return new Builder();
+        }
+
+        public Builder clear() {
+          super.clear();
+          term_ = 0L;
+          bitField0_ = (bitField0_ & ~0x00000001);
+          index_ = 0L;
+          bitField0_ = (bitField0_ & ~0x00000002);
+          if (dataBuilder_ == null) {
+            data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+          } else {
+            dataBuilder_.clear();
+          }
+          bitField0_ = (bitField0_ & ~0x00000004);
+          return this;
+        }
+
+        public Builder clone() {
+          return create().mergeFrom(buildPartial());
+        }
+
+        public com.google.protobuf.Descriptors.Descriptor
+            getDescriptorForType() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+        }
+
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getDefaultInstanceForType() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance();
+        }
+
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry build() {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = buildPartial();
+          if (!result.isInitialized()) {
+            throw newUninitializedMessageException(result);
+          }
+          return result;
+        }
+
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry buildPartial() {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry(this);
+          int from_bitField0_ = bitField0_;
+          int to_bitField0_ = 0;
+          if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+            to_bitField0_ |= 0x00000001;
+          }
+          result.term_ = term_;
+          if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+            to_bitField0_ |= 0x00000002;
+          }
+          result.index_ = index_;
+          if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+            to_bitField0_ |= 0x00000004;
+          }
+          if (dataBuilder_ == null) {
+            result.data_ = data_;
+          } else {
+            result.data_ = dataBuilder_.build();
+          }
+          result.bitField0_ = to_bitField0_;
+          onBuilt();
+          return result;
+        }
+
+        public Builder mergeFrom(com.google.protobuf.Message other) {
+          if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) {
+            return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry)other);
+          } else {
+            super.mergeFrom(other);
+            return this;
+          }
+        }
+
+        public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry other) {
+          if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance()) return this;
+          if (other.hasTerm()) {
+            setTerm(other.getTerm());
+          }
+          if (other.hasIndex()) {
+            setIndex(other.getIndex());
+          }
+          if (other.hasData()) {
+            mergeData(other.getData());
+          }
+          this.mergeUnknownFields(other.getUnknownFields());
+          return this;
+        }
+
+        public final boolean isInitialized() {
+          if (hasData()) {
+            if (!getData().isInitialized()) {
+              
+              return false;
+            }
+          }
+          return true;
+        }
+
+        public Builder mergeFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parsedMessage = null;
+          try {
+            parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+            parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) e.getUnfinishedMessage();
+            throw e;
+          } finally {
+            if (parsedMessage != null) {
+              mergeFrom(parsedMessage);
+            }
+          }
+          return this;
+        }
+        private int bitField0_;
+
+        // optional int64 term = 1;
+        private long term_ ;
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public boolean hasTerm() {
+          return ((bitField0_ & 0x00000001) == 0x00000001);
+        }
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public long getTerm() {
+          return term_;
+        }
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public Builder setTerm(long value) {
+          bitField0_ |= 0x00000001;
+          term_ = value;
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public Builder clearTerm() {
+          bitField0_ = (bitField0_ & ~0x00000001);
+          term_ = 0L;
+          onChanged();
+          return this;
+        }
+
+        // optional int64 index = 2;
+        private long index_ ;
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public boolean hasIndex() {
+          return ((bitField0_ & 0x00000002) == 0x00000002);
+        }
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public long getIndex() {
+          return index_;
+        }
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public Builder setIndex(long value) {
+          bitField0_ |= 0x00000002;
+          index_ = value;
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public Builder clearIndex() {
+          bitField0_ = (bitField0_ & ~0x00000002);
+          index_ = 0L;
+          onChanged();
+          return this;
+        }
+
+        // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+        private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+        private com.google.protobuf.SingleFieldBuilder<
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> dataBuilder_;
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public boolean hasData() {
+          return ((bitField0_ & 0x00000004) == 0x00000004);
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+          if (dataBuilder_ == null) {
+            return data_;
+          } else {
+            return dataBuilder_.getMessage();
+          }
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder setData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+          if (dataBuilder_ == null) {
+            if (value == null) {
+              throw new NullPointerException();
+            }
+            data_ = value;
+            onChanged();
+          } else {
+            dataBuilder_.setMessage(value);
+          }
+          bitField0_ |= 0x00000004;
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder setData(
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder builderForValue) {
+          if (dataBuilder_ == null) {
+            data_ = builderForValue.build();
+            onChanged();
+          } else {
+            dataBuilder_.setMessage(builderForValue.build());
+          }
+          bitField0_ |= 0x00000004;
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder mergeData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+          if (dataBuilder_ == null) {
+            if (((bitField0_ & 0x00000004) == 0x00000004) &&
+                data_ != org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) {
+              data_ =
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder(data_).mergeFrom(value).buildPartial();
+            } else {
+              data_ = value;
+            }
+            onChanged();
+          } else {
+            dataBuilder_.mergeFrom(value);
+          }
+          bitField0_ |= 0x00000004;
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder clearData() {
+          if (dataBuilder_ == null) {
+            data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+            onChanged();
+          } else {
+            dataBuilder_.clear();
+          }
+          bitField0_ = (bitField0_ & ~0x00000004);
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder getDataBuilder() {
+          bitField0_ |= 0x00000004;
+          onChanged();
+          return getDataFieldBuilder().getBuilder();
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+          if (dataBuilder_ != null) {
+            return dataBuilder_.getMessageOrBuilder();
+          } else {
+            return data_;
+          }
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        private com.google.protobuf.SingleFieldBuilder<
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> 
+            getDataFieldBuilder() {
+          if (dataBuilder_ == null) {
+            dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>(
+                    data_,
+                    getParentForChildren(),
+                    isClean());
+            data_ = null;
+          }
+          return dataBuilder_;
+        }
+
+        // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry)
+      }
+
+      static {
+        defaultInstance = new ReplicatedLogEntry(true);
+        defaultInstance.initFields();
+      }
+
+      // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry)
+    }
+
+    private int bitField0_;
+    // optional int64 term = 1;
+    public static final int TERM_FIELD_NUMBER = 1;
+    private long term_;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public boolean hasTerm() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public long getTerm() {
+      return term_;
+    }
+
+    // optional string leaderId = 2;
+    public static final int LEADERID_FIELD_NUMBER = 2;
+    private java.lang.Object leaderId_;
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    public boolean hasLeaderId() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    public java.lang.String getLeaderId() {
+      java.lang.Object ref = leaderId_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          leaderId_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getLeaderIdBytes() {
+      java.lang.Object ref = leaderId_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        leaderId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int64 prevLogIndex = 3;
+    public static final int PREVLOGINDEX_FIELD_NUMBER = 3;
+    private long prevLogIndex_;
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    public boolean hasPrevLogIndex() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    public long getPrevLogIndex() {
+      return prevLogIndex_;
+    }
+
+    // optional int64 prevLogTerm = 4;
+    public static final int PREVLOGTERM_FIELD_NUMBER = 4;
+    private long prevLogTerm_;
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    public boolean hasPrevLogTerm() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    public long getPrevLogTerm() {
+      return prevLogTerm_;
+    }
+
+    // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+    public static final int LOGENTRIES_FIELD_NUMBER = 5;
+    private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_;
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+      return logEntries_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+        getLogEntriesOrBuilderList() {
+      return logEntries_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public int getLogEntriesCount() {
+      return logEntries_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+      return logEntries_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+        int index) {
+      return logEntries_.get(index);
+    }
+
+    // optional int64 leaderCommit = 6;
+    public static final int LEADERCOMMIT_FIELD_NUMBER = 6;
+    private long leaderCommit_;
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    public boolean hasLeaderCommit() {
+      return ((bitField0_ & 0x00000010) == 0x00000010);
+    }
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    public long getLeaderCommit() {
+      return leaderCommit_;
+    }
+
+    private void initFields() {
+      term_ = 0L;
+      leaderId_ = "";
+      prevLogIndex_ = 0L;
+      prevLogTerm_ = 0L;
+      logEntries_ = java.util.Collections.emptyList();
+      leaderCommit_ = 0L;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getLogEntriesCount(); i++) {
+        if (!getLogEntries(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt64(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getLeaderIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt64(3, prevLogIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt64(4, prevLogTerm_);
+      }
+      for (int i = 0; i < logEntries_.size(); i++) {
+        output.writeMessage(5, logEntries_.get(i));
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeInt64(6, leaderCommit_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getLeaderIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(3, prevLogIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(4, prevLogTerm_);
+      }
+      for (int i = 0; i < logEntries_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(5, logEntries_.get(i));
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(6, leaderCommit_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntriesOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getLogEntriesFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        term_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        leaderId_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        prevLogIndex_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        prevLogTerm_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000008);
+        if (logEntriesBuilder_ == null) {
+          logEntries_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000010);
+        } else {
+          logEntriesBuilder_.clear();
+        }
+        leaderCommit_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000020);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries getDefaultInstanceForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries build() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries buildPartial() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.term_ = term_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.leaderId_ = leaderId_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.prevLogIndex_ = prevLogIndex_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.prevLogTerm_ = prevLogTerm_;
+        if (logEntriesBuilder_ == null) {
+          if (((bitField0_ & 0x00000010) == 0x00000010)) {
+            logEntries_ = java.util.Collections.unmodifiableList(logEntries_);
+            bitField0_ = (bitField0_ & ~0x00000010);
+          }
+          result.logEntries_ = logEntries_;
+        } else {
+          result.logEntries_ = logEntriesBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+          to_bitField0_ |= 0x00000010;
+        }
+        result.leaderCommit_ = leaderCommit_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) {
+          return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries other) {
+        if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance()) return this;
+        if (other.hasTerm()) {
+          setTerm(other.getTerm());
+        }
+        if (other.hasLeaderId()) {
+          bitField0_ |= 0x00000002;
+          leaderId_ = other.leaderId_;
+          onChanged();
+        }
+        if (other.hasPrevLogIndex()) {
+          setPrevLogIndex(other.getPrevLogIndex());
+        }
+        if (other.hasPrevLogTerm()) {
+          setPrevLogTerm(other.getPrevLogTerm());
+        }
+        if (logEntriesBuilder_ == null) {
+          if (!other.logEntries_.isEmpty()) {
+            if (logEntries_.isEmpty()) {
+              logEntries_ = other.logEntries_;
+              bitField0_ = (bitField0_ & ~0x00000010);
+            } else {
+              ensureLogEntriesIsMutable();
+              logEntries_.addAll(other.logEntries_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.logEntries_.isEmpty()) {
+            if (logEntriesBuilder_.isEmpty()) {
+              logEntriesBuilder_.dispose();
+              logEntriesBuilder_ = null;
+              logEntries_ = other.logEntries_;
+              bitField0_ = (bitField0_ & ~0x00000010);
+              logEntriesBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getLogEntriesFieldBuilder() : null;
+            } else {
+              logEntriesBuilder_.addAllMessages(other.logEntries_);
+            }
+          }
+        }
+        if (other.hasLeaderCommit()) {
+          setLeaderCommit(other.getLeaderCommit());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getLogEntriesCount(); i++) {
+          if (!getLogEntries(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional int64 term = 1;
+      private long term_ ;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public boolean hasTerm() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public long getTerm() {
+        return term_;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder setTerm(long value) {
+        bitField0_ |= 0x00000001;
+        term_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder clearTerm() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        term_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional string leaderId = 2;
+      private java.lang.Object leaderId_ = "";
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public boolean hasLeaderId() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public java.lang.String getLeaderId() {
+        java.lang.Object ref = leaderId_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          leaderId_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getLeaderIdBytes() {
+        java.lang.Object ref = leaderId_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          leaderId_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public Builder setLeaderId(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        leaderId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public Builder clearLeaderId() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        leaderId_ = getDefaultInstance().getLeaderId();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public Builder setLeaderIdBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        leaderId_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 prevLogIndex = 3;
+      private long prevLogIndex_ ;
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public boolean hasPrevLogIndex() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public long getPrevLogIndex() {
+        return prevLogIndex_;
+      }
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public Builder setPrevLogIndex(long value) {
+        bitField0_ |= 0x00000004;
+        prevLogIndex_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public Builder clearPrevLogIndex() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        prevLogIndex_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 prevLogTerm = 4;
+      private long prevLogTerm_ ;
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public boolean hasPrevLogTerm() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public long getPrevLogTerm() {
+        return prevLogTerm_;
+      }
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public Builder setPrevLogTerm(long value) {
+        bitField0_ |= 0x00000008;
+        prevLogTerm_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public Builder clearPrevLogTerm() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        prevLogTerm_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+      private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_ =
+        java.util.Collections.emptyList();
+      private void ensureLogEntriesIsMutable() {
+        if (!((bitField0_ & 0x00000010) == 0x00000010)) {
+          logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>(logEntries_);
+          bitField0_ |= 0x00000010;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> logEntriesBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+        if (logEntriesBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(logEntries_);
+        } else {
+          return logEntriesBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public int getLogEntriesCount() {
+        if (logEntriesBuilder_ == null) {
+          return logEntries_.size();
+        } else {
+          return logEntriesBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+        if (logEntriesBuilder_ == null) {
+          return logEntries_.get(index);
+        } else {
+          return logEntriesBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder setLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+        if (logEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureLogEntriesIsMutable();
+          logEntries_.set(index, value);
+          onChanged();
+        } else {
+          logEntriesBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder setLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          logEntriesBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+        if (logEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureLogEntriesIsMutable();
+          logEntries_.add(value);
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+        if (logEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureLogEntriesIsMutable();
+          logEntries_.add(index, value);
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.add(builderForValue.build());
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addAllLogEntries(
+          java.lang.Iterable<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> values) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          super.addAll(values, logEntries_);
+          onChanged();
+        } else {
+          logEntriesBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder clearLogEntries() {
+        if (logEntriesBuilder_ == null) {
+          logEntries_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000010);
+          onChanged();
+        } else {
+          logEntriesBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder removeLogEntries(int index) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.remove(index);
+          onChanged();
+        } else {
+          logEntriesBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder getLogEntriesBuilder(
+          int index) {
+        return getLogEntriesFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+          int index) {
+        if (logEntriesBuilder_ == null) {
+          return logEntries_.get(index);  } else {
+          return logEntriesBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+           getLogEntriesOrBuilderList() {
+        if (logEntriesBuilder_ != null) {
+          return logEntriesBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(logEntries_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder() {
+        return getLogEntriesFieldBuilder().addBuilder(
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder(
+          int index) {
+        return getLogEntriesFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder> 
+           getLogEntriesBuilderList() {
+        return getLogEntriesFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+          getLogEntriesFieldBuilder() {
+        if (logEntriesBuilder_ == null) {
+          logEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>(
+                  logEntries_,
+                  ((bitField0_ & 0x00000010) == 0x00000010),
+                  getParentForChildren(),
+                  isClean());
+          logEntries_ = null;
+        }
+        return logEntriesBuilder_;
+      }
+
+      // optional int64 leaderCommit = 6;
+      private long leaderCommit_ ;
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public boolean hasLeaderCommit() {
+        return ((bitField0_ & 0x00000020) == 0x00000020);
+      }
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public long getLeaderCommit() {
+        return leaderCommit_;
+      }
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public Builder setLeaderCommit(long value) {
+        bitField0_ |= 0x00000020;
+        leaderCommit_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public Builder clearLeaderCommit() {
+        bitField0_ = (bitField0_ & ~0x00000020);
+        leaderCommit_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries)
+    }
+
+    static {
+      defaultInstance = new AppendEntries(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\033AppendEntriesMessages.proto\022(org.opend" +
+      "aylight.controller.cluster.raft\"\227\003\n\rAppe" +
+      "ndEntries\022\014\n\004term\030\001 \001(\003\022\020\n\010leaderId\030\002 \001(" +
+      "\t\022\024\n\014prevLogIndex\030\003 \001(\003\022\023\n\013prevLogTerm\030\004" +
+      " \001(\003\022^\n\nlogEntries\030\005 \003(\0132J.org.opendayli" +
+      "ght.controller.cluster.raft.AppendEntrie" +
+      "s.ReplicatedLogEntry\022\024\n\014leaderCommit\030\006 \001" +
+      "(\003\032\304\001\n\022ReplicatedLogEntry\022\014\n\004term\030\001 \001(\003\022" +
+      "\r\n\005index\030\002 \001(\003\022`\n\004data\030\003 \001(\0132R.org.opend" +
+      "aylight.controller.cluster.raft.AppendEn",
+      "tries.ReplicatedLogEntry.Payload\032/\n\007Payl" +
+      "oad\022\036\n\026clientPayloadClassName\030\001 \001(\t*\004\010\002\020" +
+      "eBV\n;org.opendaylight.controller.cluster" +
+      ".raft.protobuff.messagesB\025AppendEntriesM" +
+      "essagesH\001"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor,
+              new java.lang.String[] { "Term", "LeaderId", "PrevLogIndex", "PrevLogTerm", "LogEntries", "LeaderCommit", });
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor =
+            internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor.getNestedTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor,
+              new java.lang.String[] { "Term", "Index", "Data", });
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor =
+            internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor.getNestedTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor,
+              new java.lang.String[] { "ClientPayloadClassName", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java
new file mode 100644 (file)
index 0000000..5b3bd2b
--- /dev/null
@@ -0,0 +1,767 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: VotingMessages.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class VotingMessages {
+  private VotingMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface RequestVoteOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional int64 term = 1;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    boolean hasTerm();
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    long getTerm();
+
+    // optional string candidateId = 2;
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    boolean hasCandidateId();
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    java.lang.String getCandidateId();
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getCandidateIdBytes();
+
+    // optional int64 lastLongIndex = 3;
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    boolean hasLastLongIndex();
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    long getLastLongIndex();
+
+    // optional int64 lastLongTerm = 4;
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    boolean hasLastLongTerm();
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    long getLastLongTerm();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
+   */
+  public static final class RequestVote extends
+      com.google.protobuf.GeneratedMessage
+      implements RequestVoteOrBuilder {
+    // Use RequestVote.newBuilder() to construct.
+    private RequestVote(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private RequestVote(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final RequestVote defaultInstance;
+    public static RequestVote getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public RequestVote getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private RequestVote(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              term_ = input.readInt64();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              candidateId_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              lastLongIndex_ = input.readInt64();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              lastLongTerm_ = input.readInt64();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<RequestVote> PARSER =
+        new com.google.protobuf.AbstractParser<RequestVote>() {
+      public RequestVote parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new RequestVote(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<RequestVote> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // optional int64 term = 1;
+    public static final int TERM_FIELD_NUMBER = 1;
+    private long term_;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public boolean hasTerm() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public long getTerm() {
+      return term_;
+    }
+
+    // optional string candidateId = 2;
+    public static final int CANDIDATEID_FIELD_NUMBER = 2;
+    private java.lang.Object candidateId_;
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    public boolean hasCandidateId() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    public java.lang.String getCandidateId() {
+      java.lang.Object ref = candidateId_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          candidateId_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getCandidateIdBytes() {
+      java.lang.Object ref = candidateId_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        candidateId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int64 lastLongIndex = 3;
+    public static final int LASTLONGINDEX_FIELD_NUMBER = 3;
+    private long lastLongIndex_;
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    public boolean hasLastLongIndex() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    public long getLastLongIndex() {
+      return lastLongIndex_;
+    }
+
+    // optional int64 lastLongTerm = 4;
+    public static final int LASTLONGTERM_FIELD_NUMBER = 4;
+    private long lastLongTerm_;
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    public boolean hasLastLongTerm() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    public long getLastLongTerm() {
+      return lastLongTerm_;
+    }
+
+    private void initFields() {
+      term_ = 0L;
+      candidateId_ = "";
+      lastLongIndex_ = 0L;
+      lastLongTerm_ = 0L;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt64(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getCandidateIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt64(3, lastLongIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt64(4, lastLongTerm_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getCandidateIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(3, lastLongIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(4, lastLongTerm_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVoteOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        term_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        candidateId_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        lastLongIndex_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        lastLongTerm_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000008);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote getDefaultInstanceForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote build() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote buildPartial() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = new org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.term_ = term_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.candidateId_ = candidateId_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.lastLongIndex_ = lastLongIndex_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.lastLongTerm_ = lastLongTerm_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) {
+          return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote other) {
+        if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance()) return this;
+        if (other.hasTerm()) {
+          setTerm(other.getTerm());
+        }
+        if (other.hasCandidateId()) {
+          bitField0_ |= 0x00000002;
+          candidateId_ = other.candidateId_;
+          onChanged();
+        }
+        if (other.hasLastLongIndex()) {
+          setLastLongIndex(other.getLastLongIndex());
+        }
+        if (other.hasLastLongTerm()) {
+          setLastLongTerm(other.getLastLongTerm());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional int64 term = 1;
+      private long term_ ;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public boolean hasTerm() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public long getTerm() {
+        return term_;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder setTerm(long value) {
+        bitField0_ |= 0x00000001;
+        term_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder clearTerm() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        term_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional string candidateId = 2;
+      private java.lang.Object candidateId_ = "";
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public boolean hasCandidateId() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public java.lang.String getCandidateId() {
+        java.lang.Object ref = candidateId_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          candidateId_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getCandidateIdBytes() {
+        java.lang.Object ref = candidateId_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          candidateId_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public Builder setCandidateId(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        candidateId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public Builder clearCandidateId() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        candidateId_ = getDefaultInstance().getCandidateId();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public Builder setCandidateIdBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        candidateId_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 lastLongIndex = 3;
+      private long lastLongIndex_ ;
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public boolean hasLastLongIndex() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public long getLastLongIndex() {
+        return lastLongIndex_;
+      }
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public Builder setLastLongIndex(long value) {
+        bitField0_ |= 0x00000004;
+        lastLongIndex_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public Builder clearLastLongIndex() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        lastLongIndex_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 lastLongTerm = 4;
+      private long lastLongTerm_ ;
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public boolean hasLastLongTerm() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public long getLastLongTerm() {
+        return lastLongTerm_;
+      }
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public Builder setLastLongTerm(long value) {
+        bitField0_ |= 0x00000008;
+        lastLongTerm_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public Builder clearLastLongTerm() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        lastLongTerm_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.RequestVote)
+    }
+
+    static {
+      defaultInstance = new RequestVote(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.RequestVote)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\024VotingMessages.proto\022(org.opendaylight" +
+      ".controller.cluster.raft\"]\n\013RequestVote\022" +
+      "\014\n\004term\030\001 \001(\003\022\023\n\013candidateId\030\002 \001(\t\022\025\n\rla" +
+      "stLongIndex\030\003 \001(\003\022\024\n\014lastLongTerm\030\004 \001(\003B" +
+      "O\n;org.opendaylight.controller.cluster.r" +
+      "aft.protobuff.messagesB\016VotingMessagesH\001"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor,
+              new java.lang.String[] { "Term", "CandidateId", "LastLongIndex", "LastLongTerm", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto
new file mode 100644 (file)
index 0000000..ab591ea
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "AppendEntriesMessages";
+option optimize_for = SPEED;
+
+message AppendEntries {
+    optional int64 term = 1;
+    optional string leaderId = 2;
+    optional int64 prevLogIndex = 3;
+    optional int64 prevLogTerm = 4;
+
+    message ReplicatedLogEntry {
+        optional int64 term = 1;
+        optional int64 index = 2;
+
+        message Payload {
+            optional string clientPayloadClassName = 1;
+            extensions 2 to 100;
+        }
+
+        optional Payload data = 3;
+    }
+
+    repeated ReplicatedLogEntry logEntries = 5;
+    optional int64 leaderCommit = 6;
+
+}
+
+
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto
new file mode 100644 (file)
index 0000000..7ee0b21
--- /dev/null
@@ -0,0 +1,13 @@
+package org.opendaylight.controller.cluster.raft;
+
+import "AppendEntriesMessages.proto";
+
+option java_package = "org.opendaylight.controller.cluster.example.protobuff.messages";
+option java_outer_classname = "KeyValueMessages";
+option optimize_for = SPEED;
+
+// proto file for the payload of Example, extending AppendEntries
+extend AppendEntries.ReplicatedLogEntry.Payload {
+    optional string key = 2;
+    optional string value = 3;
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto
new file mode 100644 (file)
index 0000000..6a45a2b
--- /dev/null
@@ -0,0 +1,13 @@
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "VotingMessages";
+option optimize_for = SPEED;
+
+message RequestVote {
+    optional int64 term = 1;
+    optional string candidateId = 2;
+    optional int64 lastLongIndex = 3;
+    optional int64 lastLongTerm = 4;
+
+}
index 494a99e..9e42a13 100644 (file)
@@ -1,12 +1,20 @@
 akka {
+
     loglevel = "DEBUG"
+
     actor {
+        # enable to test serialization only.
+        # serialize-messages = on
+
         serializers {
-          java = "akka.serialization.JavaSerializer"
+          java  = "akka.serialization.JavaSerializer"
+          proto = "akka.remote.serialization.ProtobufSerializer"
         }
 
         serialization-bindings {
-            "org.opendaylight.controller.cluster.raft.RaftActor$ReplicatedLogImplEntry" = java
+            "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
+            "com.google.protobuf.Message" = proto
+            "com.google.protobuf.GeneratedMessage" = proto
         }
     }
 }
index 77d0071..406c164 100644 (file)
@@ -14,7 +14,12 @@ import akka.actor.ActorSystem;
 import akka.actor.Props;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -79,7 +84,7 @@ public class MockRaftActorContext implements RaftActorContext {
 
     public void initReplicatedLog(){
         this.replicatedLog = new SimpleReplicatedLog();
-        this.replicatedLog.append(new MockReplicatedLogEntry(1, 1, ""));
+        this.replicatedLog.append(new MockReplicatedLogEntry(1, 1, new MockPayload("")));
     }
 
     @Override public ActorRef actorOf(Props props) {
@@ -255,20 +260,49 @@ public class MockRaftActorContext implements RaftActorContext {
         }
     }
 
-    public static class MockReplicatedLogEntry implements ReplicatedLogEntry {
+    public static class MockPayload extends Payload implements Serializable {
+        private String value = "";
+
+        public MockPayload(String s) {
+            this.value = s;
+        }
+
+        @Override public  Map<GeneratedMessage.GeneratedExtension, String> encode() {
+            Map<GeneratedMessage.GeneratedExtension, String> map = new HashMap<GeneratedMessage.GeneratedExtension, String>();
+            map.put(MockPayloadMessages.value, value);
+            return map;
+        }
+
+        @Override public Payload decode(
+            AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) {
+            String value = payloadProtoBuff.getExtension(MockPayloadMessages.value);
+            this.value = value;
+            return this;
+        }
+
+        @Override public String getClientPayloadClassName() {
+            return MockPayload.class.getName();
+        }
+
+        public String toString() {
+            return value;
+        }
+    }
+
+    public static class MockReplicatedLogEntry implements ReplicatedLogEntry, Serializable {
 
         private final long term;
         private final long index;
-        private final Object data;
+        private final Payload data;
 
-        public MockReplicatedLogEntry(long term, long index, Object data){
+        public MockReplicatedLogEntry(long term, long index, Payload data){
 
             this.term = term;
             this.index = index;
             this.data = data;
         }
 
-        @Override public Object getData() {
+        @Override public Payload getData() {
             return data;
         }
 
index 1a37b92..8068dfb 100644 (file)
@@ -9,11 +9,13 @@ import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.SerializationUtils;
 import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
 import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
 import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
 import org.opendaylight.controller.cluster.raft.messages.RequestVote;
 import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
 
 import java.util.ArrayList;
@@ -120,13 +122,13 @@ public abstract class AbstractRaftActorBehaviorTest extends AbstractActorTest {
                 MockRaftActorContext.SimpleReplicatedLog log =
                     new MockRaftActorContext.SimpleReplicatedLog();
                 log.append(
-                    new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+                    new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
 
                 context.setReplicatedLog(log);
 
                 List<ReplicatedLogEntry> entries = new ArrayList<>();
                 entries.add(
-                    new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+                    new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
 
                 AppendEntries appendEntries =
                     new AppendEntries(2, "leader-1", -1, 1, entries, 0);
@@ -220,7 +222,7 @@ public abstract class AbstractRaftActorBehaviorTest extends AbstractActorTest {
                         log = new MockRaftActorContext.SimpleReplicatedLog();
                     log.append(
                         new MockRaftActorContext.MockReplicatedLogEntry(20000,
-                            1000000, ""));
+                            1000000, new MockRaftActorContext.MockPayload("")));
 
                     ((MockRaftActorContext) actorContext).setReplicatedLog(log);
 
@@ -303,8 +305,9 @@ public abstract class AbstractRaftActorBehaviorTest extends AbstractActorTest {
         ActorRef actorRef, RaftRPC rpc) {
 
         RaftActorContext actorContext = createActorContext();
+        Payload p = new MockRaftActorContext.MockPayload("");
         setLastLogEntry(
-            (MockRaftActorContext) actorContext, 0, 0, "");
+            (MockRaftActorContext) actorContext, 0, 0, p);
 
         RaftState raftState = createBehavior(actorContext)
             .handleMessage(actorRef, rpc);
@@ -313,7 +316,7 @@ public abstract class AbstractRaftActorBehaviorTest extends AbstractActorTest {
     }
 
     protected MockRaftActorContext.SimpleReplicatedLog setLastLogEntry(
-        MockRaftActorContext actorContext, long term, long index, Object data) {
+        MockRaftActorContext actorContext, long term, long index, Payload data) {
         return setLastLogEntry(actorContext,
             new MockRaftActorContext.MockReplicatedLogEntry(term, index, data));
     }
@@ -359,6 +362,7 @@ public abstract class AbstractRaftActorBehaviorTest extends AbstractActorTest {
         return new RequestVoteReply(100, false);
     }
 
-
-
+    protected Object fromSerializableMessage(Object serializable){
+        return SerializationUtils.fromSerializable(serializable);
+    }
 }
index b7c371d..126e7d1 100644 (file)
@@ -157,12 +157,12 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
                 createActorContext();
 
             context.setLastApplied(100);
-            setLastLogEntry((MockRaftActorContext) context, 0, 0, "");
+            setLastLogEntry((MockRaftActorContext) context, 0, 0, new MockRaftActorContext.MockPayload(""));
 
             List<ReplicatedLogEntry> entries =
                 Arrays.asList(
                     (ReplicatedLogEntry) new MockRaftActorContext.MockReplicatedLogEntry(100, 101,
-                        "foo")
+                        new MockRaftActorContext.MockPayload("foo"))
                 );
 
             // The new commitIndex is 101
@@ -198,7 +198,7 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
             // Set the last log entry term for the receiver to be greater than
             // what we will be sending as the prevLogTerm in AppendEntries
             MockRaftActorContext.SimpleReplicatedLog mockReplicatedLog =
-                setLastLogEntry(context, 20, 0, "");
+                setLastLogEntry(context, 20, 0, new MockRaftActorContext.MockPayload(""));
 
             // AppendEntries is now sent with a bigger term
             // this will set the receivers term to be the same as the sender's term
@@ -259,20 +259,20 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
             MockRaftActorContext.SimpleReplicatedLog log =
                 new MockRaftActorContext.SimpleReplicatedLog();
             log.append(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
             log.append(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 1, "one"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("one")));
             log.append(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 2, "two"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 2, new MockRaftActorContext.MockPayload("two")));
 
             context.setReplicatedLog(log);
 
             // Prepare the entries to be sent with AppendEntries
             List<ReplicatedLogEntry> entries = new ArrayList<>();
             entries.add(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 3, "three"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 3, new MockRaftActorContext.MockPayload("three")));
             entries.add(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 4, "four"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 4, new MockRaftActorContext.MockPayload("four")));
 
             // Send appendEntries with the same term as was set on the receiver
             // before the new behavior was created (1 in this case)
@@ -339,20 +339,20 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
             MockRaftActorContext.SimpleReplicatedLog log =
                 new MockRaftActorContext.SimpleReplicatedLog();
             log.append(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
             log.append(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 1, "one"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("one")));
             log.append(
-                new MockRaftActorContext.MockReplicatedLogEntry(1, 2, "two"));
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 2, new MockRaftActorContext.MockPayload("two")));
 
             context.setReplicatedLog(log);
 
             // Prepare the entries to be sent with AppendEntries
             List<ReplicatedLogEntry> entries = new ArrayList<>();
             entries.add(
-                new MockRaftActorContext.MockReplicatedLogEntry(2, 2, "two-1"));
+                new MockRaftActorContext.MockReplicatedLogEntry(2, 2, new MockRaftActorContext.MockPayload("two-1")));
             entries.add(
-                new MockRaftActorContext.MockReplicatedLogEntry(2, 3, "three"));
+                new MockRaftActorContext.MockReplicatedLogEntry(2, 3, new MockRaftActorContext.MockPayload("three")));
 
             // Send appendEntries with the same term as was set on the receiver
             // before the new behavior was created (1 in this case)
@@ -378,13 +378,13 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
             assertEquals(4, log.last().getIndex() + 1);
             assertNotNull(log.get(2));
 
-
-            assertEquals("one", log.get(1).getData());
+            assertEquals("one", log.get(1).getData().toString());
 
             // Check that the entry at index 2 has the new data
-            assertEquals("two-1", log.get(2).getData());
+            assertEquals("two-1", log.get(2).getData().toString());
+
+            assertEquals("three", log.get(3).getData().toString());
 
-            assertEquals("three", log.get(3).getData());
             assertNotNull(log.get(3));
 
             // Also expect an AppendEntriesReply to be sent where success is false
index 35bf6f1..bc9d4a2 100644 (file)
@@ -63,13 +63,12 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
                     leader.handleMessage(senderActor, new SendHeartBeat());
 
                     final String out =
-                        new ExpectMsg<String>(duration("1 seconds"),
-                            "match hint") {
+                        new ExpectMsg<String>(duration("1 seconds"), "match hint") {
                             // do not put code outside this method, will run afterwards
                             protected String match(Object in) {
-                                if (in instanceof AppendEntries) {
-                                    if (((AppendEntries) in).getTerm()
-                                        == 0) {
+                                Object msg = fromSerializableMessage(in);
+                                if (msg instanceof AppendEntries) {
+                                    if (((AppendEntries)msg).getTerm() == 0) {
                                         return "match";
                                     }
                                     return null;
@@ -112,20 +111,19 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
                         .handleMessage(senderActor, new Replicate(null, null,
                             new MockRaftActorContext.MockReplicatedLogEntry(1,
                                 100,
-                                "foo")
+                                new MockRaftActorContext.MockPayload("foo"))
                         ));
 
                     // State should not change
                     assertEquals(RaftState.Leader, raftState);
 
                     final String out =
-                        new ExpectMsg<String>(duration("1 seconds"),
-                            "match hint") {
+                        new ExpectMsg<String>(duration("1 seconds"), "match hint") {
                             // do not put code outside this method, will run afterwards
                             protected String match(Object in) {
-                                if (in instanceof AppendEntries) {
-                                    if (((AppendEntries) in).getTerm()
-                                        == 0) {
+                                Object msg = fromSerializableMessage(in);
+                                if (msg instanceof AppendEntries) {
+                                    if (((AppendEntries)msg).getTerm() == 0) {
                                         return "match";
                                     }
                                     return null;
@@ -161,7 +159,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
                         .handleMessage(senderActor, new Replicate(null, "state-id",
                             new MockRaftActorContext.MockReplicatedLogEntry(1,
                                 100,
-                                "foo")
+                                new MockRaftActorContext.MockPayload("foo"))
                         ));
 
                     // State should not change
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java
new file mode 100644 (file)
index 0000000..1f618a3
--- /dev/null
@@ -0,0 +1,57 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: MockPayload.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class MockPayloadMessages {
+  private MockPayloadMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+    registry.add(org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages.value);
+  }
+  public static final int VALUE_FIELD_NUMBER = 2;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      java.lang.String> value = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        java.lang.String.class,
+        null);
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\021MockPayload.proto\022(org.opendaylight.co" +
+      "ntroller.cluster.raft\032\033AppendEntriesMess" +
+      "ages.proto:a\n\005value\022R.org.opendaylight.c" +
+      "ontroller.cluster.raft.AppendEntries.Rep" +
+      "licatedLogEntry.Payload\030\002 \001(\tBR\n;org.ope" +
+      "ndaylight.controller.cluster.raft.protob" +
+      "uff.messagesB\023MockPayloadMessages"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          value.internalInit(descriptor.getExtensions().get(0));
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto b/opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto
new file mode 100644 (file)
index 0000000..0e0c604
--- /dev/null
@@ -0,0 +1,10 @@
+import "AppendEntriesMessages.proto";
+
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "MockPayloadMessages";
+
+extend AppendEntries.ReplicatedLogEntry.Payload {
+    optional string value = 2;
+}
index 2647850..dbe7508 100644 (file)
@@ -1,11 +1,20 @@
 akka {
+
+    loglevel = "DEBUG"
+
     actor {
+        # enable to test serialization only.
+        serialize-messages = on
+
         serializers {
-          java = "akka.serialization.JavaSerializer"
+          java  = "akka.serialization.JavaSerializer"
+          proto = "akka.remote.serialization.ProtobufSerializer"
         }
 
         serialization-bindings {
-            "org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification" = java
+            "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
+            "com.google.protobuf.Message" = proto
+            "com.google.protobuf.GeneratedMessage" = proto
         }
     }
-}
\ No newline at end of file
+}

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.