Merge "BUG 2317 : StatisticsManager does not unregister from yang notifications on...
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformation.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.util.concurrent.atomic.AtomicLong;
12
13 /**
14  * The state of the followers log as known by the Leader
15  */
16 public interface FollowerLogInformation {
17
18     /**
19      * Increment the value of the nextIndex
20      * @return
21      */
22     public long incrNextIndex();
23
24     /**
25      * Decrement the value of the nextIndex
26      * @return
27      */
28     public long decrNextIndex();
29
30     /**
31      *
32      * @param nextIndex
33      */
34     void setNextIndex(long nextIndex);
35
36     /**
37      * Increment the value of the matchIndex
38      * @return
39      */
40     public long incrMatchIndex();
41
42     public void setMatchIndex(long matchIndex);
43
44     /**
45      * The identifier of the follower
46      * This could simply be the url of the remote actor
47      */
48     public String getId();
49
50     /**
51      * for each server, index of the next log entry
52      * to send to that server (initialized to leader
53      *    last log index + 1)
54      */
55     public AtomicLong getNextIndex();
56
57     /**
58      * for each server, index of highest log entry
59      * known to be replicated on server
60      *    (initialized to 0, increases monotonically)
61      */
62     public AtomicLong getMatchIndex();
63
64     /**
65      * Checks if the follower is active by comparing the last updated with the duration
66      * @return boolean
67      */
68     public boolean isFollowerActive();
69
70     /**
71      * restarts the timeout clock of the follower
72      */
73     public void markFollowerActive();
74
75
76 }