X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FFollowerLogInformation.java;h=73c81afd187d2791703c1428beacbc8348abda69;hp=f3de9835385eb0880bb567402f5bb493f8ad3a76;hb=e3918142bf119759d092af5c7fa72807b3a467e0;hpb=d255fdd0b14660a22ff63771d954ac3fe5d0cb7e diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java index f3de983538..73c81afd18 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java @@ -5,11 +5,8 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.raft; -import java.util.concurrent.atomic.AtomicLong; - /** * The state of the followers log as known by the Leader */ @@ -19,13 +16,13 @@ public interface FollowerLogInformation { * Increment the value of the nextIndex * @return */ - public long incrNextIndex(); + long incrNextIndex(); /** * Decrement the value of the nextIndex * @return */ - public long decrNextIndex(); + long decrNextIndex(); /** * @@ -37,29 +34,51 @@ public interface FollowerLogInformation { * Increment the value of the matchIndex * @return */ - public long incrMatchIndex(); + long incrMatchIndex(); - public void setMatchIndex(long matchIndex); + void setMatchIndex(long matchIndex); /** * The identifier of the follower * This could simply be the url of the remote actor */ - public String getId(); + String getId(); /** * for each server, index of the next log entry * to send to that server (initialized to leader * last log index + 1) */ - public AtomicLong getNextIndex(); + long getNextIndex(); /** * for each server, index of highest log entry * known to be replicated on server * (initialized to 0, increases monotonically) */ - public AtomicLong getMatchIndex(); + long getMatchIndex(); + + /** + * Checks if the follower is active by comparing the last updated with the duration + * @return boolean + */ + boolean isFollowerActive(); + + /** + * restarts the timeout clock of the follower + */ + void markFollowerActive(); + + /** + * This will stop the timeout clock + */ + void markFollowerInActive(); + /** + * This will return the active time of follower, since it was last reset + * @return time in milliseconds + */ + long timeSinceLastActivity(); + }