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 {
18 VOTING_NOT_INITIALIZED
22 * Increment the value of the nextIndex
24 * @return the new value of nextIndex
29 * Decrement the value of the nextIndex
31 * @return the new value of nextIndex
36 * Sets the index of the next log entry for this follower.
39 * @return true if the new index differed from the current index and the current index was updated, false
42 boolean setNextIndex(long nextIndex);
45 * Increment the value of the matchIndex
47 * @return the new value of matchIndex
49 long incrMatchIndex();
52 * Sets the index of the highest log entry for this follower.
55 * @return true if the new index differed from the current index and the current index was updated, false
58 boolean setMatchIndex(long matchIndex);
62 * @return the identifier of the follower. This could simply be the url of the remote actor.
67 * @return index of the next log entry to send to that server (initialized to leader last log index + 1)
72 * @return index of highest log entry known to be replicated on server (initialized to 0, increases monotonically)
77 * Checks if the follower is active by comparing the last updated with the duration
79 * @return true if follower is active, false otherwise
81 boolean isFollowerActive();
84 * restarts the timeout clock of the follower
86 void markFollowerActive();
89 * This will stop the timeout clock
91 void markFollowerInActive();
95 * This will return the active time of follower, since it was last reset
97 * @return time in milliseconds since the last activity from the follower
99 long timeSinceLastActivity();
102 * This method checks if it is ok to replicate
104 * @return true if it is ok to replicate, false otherwise
106 boolean okToReplicate();
109 * @return the payload data version of the follower.
111 short getPayloadVersion();
114 * Sets the payload data version of the follower.
116 void setPayloadVersion(short payloadVersion);
119 * Sets the state of the follower.
121 void setFollowerState(FollowerState state);
124 * @return the state of the follower.
126 FollowerState getFollowerState();
129 * @return true if the follower is in a state where it can participate in leader elections and
130 * commitment consensus.
132 boolean canParticipateInConsensus();