d2100cb950654785e748fa324431651ff44b46a0
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / FollowerInitialSyncUpStatus.java
1 /*
2  * Copyright (c) 2015 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 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13
14 /**
15  * The FollowerInitialSyncUpStatus is sent by a Follower to inform any RaftActor subclass whether the Follower
16  * is at least at the same commitIndex as the Leader was when it sent the follower the very first heartbeat.
17  *
18  * This status can be used to determine if a Follower has caught up with the current Leader in an upgrade scenario
19  * for example.
20  */
21 public final class FollowerInitialSyncUpStatus {
22     private final boolean initialSyncDone;
23     private final String name;
24
25     public FollowerInitialSyncUpStatus(final boolean initialSyncDone, @Nonnull final String name) {
26         this.initialSyncDone = initialSyncDone;
27         this.name = Preconditions.checkNotNull(name);
28     }
29
30     public boolean isInitialSyncDone() {
31         return initialSyncDone;
32     }
33
34     @Nonnull public String getName() {
35         return name;
36     }
37 }