2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.raft;
11 * The state of the followers log as known by the Leader
13 public interface FollowerLogInformation {
16 * Increment the value of the nextIndex
18 * @return the new value of nextIndex
23 * Decrement the value of the nextIndex
25 * @return the new value of nextIndex
30 * Sets the index of the next log entry for this follower.
33 * @return true if the new index differed from the current index and the current index was updated, false
36 boolean setNextIndex(long nextIndex);
39 * Increment the value of the matchIndex
41 * @return the new value of matchIndex
43 long incrMatchIndex();
46 * Sets the index of the highest log entry for this follower.
49 * @return true if the new index differed from the current index and the current index was updated, false
52 boolean setMatchIndex(long matchIndex);
56 * @return the identifier of the follower. This could simply be the url of the remote actor.
61 * @return index of the next log entry to send to that server (initialized to leader last log index + 1)
66 * @return index of highest log entry known to be replicated on server (initialized to 0, increases monotonically)
71 * Checks if the follower is active by comparing the last updated with the duration
73 * @return true if follower is active, false otherwise
75 boolean isFollowerActive();
78 * restarts the timeout clock of the follower
80 void markFollowerActive();
83 * This will stop the timeout clock
85 void markFollowerInActive();
89 * This will return the active time of follower, since it was last reset
91 * @return time in milliseconds since the last activity from the follower
93 long timeSinceLastActivity();
96 * This method checks if it is ok to replicate
98 * @return true if it is ok to replicate, false otherwise
100 boolean okToReplicate();
103 * @return the payload data version of the follower.
105 short getPayloadVersion();
108 * Sets the payload data version of the follower.
110 void setPayloadVersion(short payloadVersion);
113 * @return the raft version of the follower.
115 short getRaftVersion();
118 * Sets the raft version of the follower.
120 void setRaftVersion(short payloadVersion);