Merge "Refactor TransactionProxy"
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / ReplicatedLogImplEntry.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.cluster.raft;
10
11 import java.io.Serializable;
12 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
13
14 public class ReplicatedLogImplEntry implements ReplicatedLogEntry, Serializable {
15     private static final long serialVersionUID = -9085798014576489130L;
16
17     private final long index;
18     private final long term;
19     private final Payload payload;
20
21     public ReplicatedLogImplEntry(long index, long term, Payload payload) {
22
23         this.index = index;
24         this.term = term;
25         this.payload = payload;
26     }
27
28     @Override
29     public Payload getData() {
30         return payload;
31     }
32
33     @Override
34     public long getTerm() {
35         return term;
36     }
37
38     @Override
39     public long getIndex() {
40         return index;
41     }
42
43     @Override
44     public int size() {
45         return getData().size();
46     }
47
48     @Override
49     public String toString() {
50         return "Entry{" +
51             "index=" + index +
52             ", term=" + term +
53             '}';
54     }
55 }