2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.raft.messages;
11 import java.util.List;
14 * Invoked by leader to replicate log entries (§5.3); also used as
17 public class AppendEntries extends AbstractRaftRPC {
18 // So that follower can redirect clients
19 private final String leaderId;
21 // Index of log entry immediately preceding new ones
22 private final long prevLogIndex;
24 // term of prevLogIndex entry
25 private final long prevLogTerm;
27 // log entries to store (empty for heartbeat;
28 // may send more than one for efficiency)
29 private final List<Object> entries;
31 // leader's commitIndex
32 private final long leaderCommit;
34 public AppendEntries(long term, String leaderId, long prevLogIndex,
35 long prevLogTerm, List<Object> entries, long leaderCommit) {
37 this.leaderId = leaderId;
38 this.prevLogIndex = prevLogIndex;
39 this.prevLogTerm = prevLogTerm;
40 this.entries = entries;
41 this.leaderCommit = leaderCommit;
44 public String getLeaderId() {
48 public long getPrevLogIndex() {
52 public long getPrevLogTerm() {
56 public List<Object> getEntries() {
60 public long getLeaderCommit() {