blob: aa984c0bf481e87372bdb2244989610667a9a393 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.cluster;
tom73d6d1e2014-09-17 20:08:01 -070017
18import java.util.Set;
19
Madan Jampani7d2fab22015-03-18 17:21:57 -070020import org.joda.time.DateTime;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070021import org.onosproject.event.ListenerService;
Madan Jampani7d2fab22015-03-18 17:21:57 -070022
tom73d6d1e2014-09-17 20:08:01 -070023/**
tome4729872014-09-23 00:37:37 -070024 * Service for obtaining information about the individual nodes within
tom73d6d1e2014-09-17 20:08:01 -070025 * the controller cluster.
26 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070027public interface ClusterService
28 extends ListenerService<ClusterEvent, ClusterEventListener> {
tom73d6d1e2014-09-17 20:08:01 -070029
30 /**
tome4729872014-09-23 00:37:37 -070031 * Returns the local controller node.
32 *
33 * @return local controller node
34 */
35 ControllerNode getLocalNode();
36
37 /**
tom73d6d1e2014-09-17 20:08:01 -070038 * Returns the set of current cluster members.
39 *
40 * @return set of cluster members
41 */
tome4729872014-09-23 00:37:37 -070042 Set<ControllerNode> getNodes();
tom73d6d1e2014-09-17 20:08:01 -070043
44 /**
tome4729872014-09-23 00:37:37 -070045 * Returns the specified controller node.
tom73d6d1e2014-09-17 20:08:01 -070046 *
tome4729872014-09-23 00:37:37 -070047 * @param nodeId controller node identifier
48 * @return controller node
49 */
50 ControllerNode getNode(NodeId nodeId);
51
52 /**
Thomas Vachuska7a8de842016-03-07 20:56:35 -080053 * Returns the availability state of the specified controller node. Note
54 * that this does not imply that all the core and application components
55 * have been fully activated; only that the node has joined the cluster.
tome4729872014-09-23 00:37:37 -070056 *
57 * @param nodeId controller node identifier
tom73d6d1e2014-09-17 20:08:01 -070058 * @return availability state
59 */
tome4729872014-09-23 00:37:37 -070060 ControllerNode.State getState(NodeId nodeId);
tom73d6d1e2014-09-17 20:08:01 -070061
tomfc9a4ff2014-09-22 18:22:47 -070062 /**
Madan Jampani7d2fab22015-03-18 17:21:57 -070063 * Returns the system time when the availability state was last updated.
64 *
65 * @param nodeId controller node identifier
66 * @return system time when the availability state was last updated.
67 */
68 DateTime getLastUpdated(NodeId nodeId);
69
tom73d6d1e2014-09-17 20:08:01 -070070}