Merge "Add Distributed DataStore as a dependency of the Simulator"
[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 package org.opendaylight.controller.cluster.raft;
9
10 /**
11  * The state of the followers log as known by the Leader
12  */
13 public interface FollowerLogInformation {
14
15     /**
16      * Increment the value of the nextIndex
17      * @return
18      */
19     long incrNextIndex();
20
21     /**
22      * Decrement the value of the nextIndex
23      * @return
24      */
25     long decrNextIndex();
26
27     /**
28      *
29      * @param nextIndex
30      */
31     void setNextIndex(long nextIndex);
32
33     /**
34      * Increment the value of the matchIndex
35      * @return
36      */
37     long incrMatchIndex();
38
39     void setMatchIndex(long matchIndex);
40
41     /**
42      * The identifier of the follower
43      * This could simply be the url of the remote actor
44      */
45     String getId();
46
47     /**
48      * for each server, index of the next log entry
49      * to send to that server (initialized to leader
50      *    last log index + 1)
51      */
52     long getNextIndex();
53
54     /**
55      * for each server, index of highest log entry
56      * known to be replicated on server
57      *    (initialized to 0, increases monotonically)
58      */
59     long getMatchIndex();
60
61     /**
62      * Checks if the follower is active by comparing the last updated with the duration
63      * @return boolean
64      */
65     boolean isFollowerActive();
66
67     /**
68      * restarts the timeout clock of the follower
69      */
70     void markFollowerActive();
71
72     /**
73      * This will stop the timeout clock
74      */
75     void markFollowerInActive();
76
77
78     /**
79      * This will return the active time of follower, since it was last reset
80      * @return time in milliseconds
81      */
82     long timeSinceLastActivity();
83
84 }