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 {
19 private final long term;
21 // So that follower can redirect clients
22 private final String leaderId;
24 // Index of log entry immediately preceding new ones
25 private final long prevLogIndex;
27 // term of prevLogIndex entry
28 private final long prevLogTerm;
30 // log entries to store (empty for heartbeat;
31 // may send more than one for efficiency)
32 private final List<Object> entries;
34 public AppendEntries(long term, String leaderId, long prevLogIndex,
35 long prevLogTerm, List<Object> entries) {
37 this.leaderId = leaderId;
38 this.prevLogIndex = prevLogIndex;
39 this.prevLogTerm = prevLogTerm;
40 this.entries = entries;
43 public long getTerm() {
47 public String getLeaderId() {
51 public long getPrevLogIndex() {
55 public long getPrevLogTerm() {
59 public List<Object> getEntries() {