BUG 2185: Expand the scope of sync status to cover a slow follower
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / jmx / mbeans / shardmanager / ShardManagerInfoMBean.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.datastore.jmx.mbeans.shardmanager;
10
11 import java.util.List;
12
13 public interface ShardManagerInfoMBean {
14     /**
15      *
16      * @return a list of all the local shard names
17      */
18     List<String> getLocalShards();
19
20     /**
21      *
22      * @return true if all local shards are in sync with their corresponding leaders
23      */
24     boolean getSyncStatus();
25
26     /**
27      * Get the name of of the current member
28      *
29      * @return
30      */
31     String getMemberName();
32
33     /**
34      * Switch the Raft Behavior of all the local shards to the newBehavior
35      *
36      * @param newBehavior should be either Leader/Follower only
37      * @param term when switching to the Leader specifies for which term the Shard would be the Leader. Any modifications
38      *             made to state will be written with this term. This term will then be used by the Raft replication
39      *             implementation to decide which modifications should stay and which ones should be removed. Ideally
40      *             the term provided when switching to a new Leader should always be higher than the previous term.
41      */
42     void switchAllLocalShardsState(String newBehavior, long term);
43
44     /**
45      * Switch the Raft Behavior of the shard specified by shardName to the newBehavior
46      *
47      * @param shardName a shard that is local to this shard manager
48      * @param newBehavior should be either Leader/Follower only
49      * @param term when switching to the Leader specifies for which term the Shard would be the Leader. Any modifications
50      *             made to state will be written with this term. This term will then be used by the Raft replication
51      *             implementation to decide which modifications should stay and which ones should be removed. Ideally
52      *             the term provided when switching to a new Leader should always be higher than the previous term.
53      */
54     void switchShardState(String shardName, String newBehavior, long term);
55 }