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;
11 import com.google.common.base.Preconditions;
12 import java.io.Serializable;
13 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
16 * A {@link ReplicatedLogEntry} implementation.
18 public final class ReplicatedLogImplEntry implements ReplicatedLogEntry, Serializable {
19 private static final long serialVersionUID = -9085798014576489130L;
21 private final long index;
22 private final long term;
23 private final Payload payload;
25 public ReplicatedLogImplEntry(final long index, final long term, final Payload payload) {
28 this.payload = Preconditions.checkNotNull(payload);
32 public Payload getData() {
37 public long getTerm() {
42 public long getIndex() {
48 return getData().size();
52 public String toString() {
53 return "Entry{index=" + index + ", term=" + term + '}';