Add RaftActor integration tests
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / CaptureSnapshot.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.base.messages;
10
11 public class CaptureSnapshot {
12     private final long lastAppliedIndex;
13     private final long lastAppliedTerm;
14     private final long lastIndex;
15     private final long lastTerm;
16     private final boolean installSnapshotInitiated;
17     private final long replicatedToAllIndex;
18     private final long replicatedToAllTerm;
19
20     public CaptureSnapshot(long lastIndex, long lastTerm,
21         long lastAppliedIndex, long lastAppliedTerm, long replicatedToAllIndex, long replicatedToAllTerm) {
22         this(lastIndex, lastTerm, lastAppliedIndex, lastAppliedTerm, replicatedToAllIndex , replicatedToAllTerm, false);
23     }
24
25     public CaptureSnapshot(long lastIndex, long lastTerm,long lastAppliedIndex,
26         long lastAppliedTerm, long replicatedToAllIndex, long replicatedToAllTerm, boolean installSnapshotInitiated) {
27         this.lastIndex = lastIndex;
28         this.lastTerm = lastTerm;
29         this.lastAppliedIndex = lastAppliedIndex;
30         this.lastAppliedTerm = lastAppliedTerm;
31         this.installSnapshotInitiated = installSnapshotInitiated;
32         this.replicatedToAllIndex = replicatedToAllIndex;
33         this.replicatedToAllTerm = replicatedToAllTerm;
34     }
35
36     public long getLastAppliedIndex() {
37         return lastAppliedIndex;
38     }
39
40     public long getLastAppliedTerm() {
41         return lastAppliedTerm;
42     }
43
44     public long getLastIndex() {
45         return lastIndex;
46     }
47
48     public long getLastTerm() {
49         return lastTerm;
50     }
51
52     public boolean isInstallSnapshotInitiated() {
53         return installSnapshotInitiated;
54     }
55
56     public long getReplicatedToAllIndex() {
57         return replicatedToAllIndex;
58     }
59
60     public long getReplicatedToAllTerm() {
61         return replicatedToAllTerm;
62     }
63
64     @Override
65     public String toString() {
66         StringBuilder builder = new StringBuilder();
67         builder.append("CaptureSnapshot [lastAppliedIndex=").append(lastAppliedIndex).append(", lastAppliedTerm=")
68                 .append(lastAppliedTerm).append(", lastIndex=").append(lastIndex).append(", lastTerm=")
69                 .append(lastTerm).append(", installSnapshotInitiated=").append(installSnapshotInitiated)
70                 .append(", replicatedToAllIndex=").append(replicatedToAllIndex).append(", replicatedToAllTerm=")
71                 .append(replicatedToAllTerm).append("]");
72         return builder.toString();
73     }
74 }

©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.