blob: 0481d510c46c41e43b0fa9071d03df4e11c46c55 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 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;
tome4729872014-09-23 00:37:37 -070017
Madan Jampani7d2fab22015-03-18 17:21:57 -070018import org.joda.time.DateTime;
19import org.onlab.packet.IpAddress;
20import org.onosproject.store.Store;
21
Thomas Vachuskade563cf2015-04-01 00:28:50 -070022import java.util.Set;
23
tome4729872014-09-23 00:37:37 -070024/**
25 * Manages inventory of controller cluster nodes; not intended for direct use.
26 */
tom0755a362014-09-24 11:54:43 -070027public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> {
tome4729872014-09-23 00:37:37 -070028
29 /**
tomb41d1ac2014-09-24 01:51:24 -070030 * Returns the local controller node.
tome4729872014-09-23 00:37:37 -070031 *
32 * @return local controller instance
33 */
34 ControllerNode getLocalNode();
35
36 /**
37 * Returns the set of current cluster members.
38 *
39 * @return set of cluster members
40 */
41 Set<ControllerNode> getNodes();
42
43 /**
tomb41d1ac2014-09-24 01:51:24 -070044 * Returns the specified controller node.
tome4729872014-09-23 00:37:37 -070045 *
46 * @param nodeId controller instance identifier
47 * @return controller instance
48 */
49 ControllerNode getNode(NodeId nodeId);
50
51 /**
tomb41d1ac2014-09-24 01:51:24 -070052 * Returns the availability state of the specified controller node.
tome4729872014-09-23 00:37:37 -070053 *
54 * @param nodeId controller instance identifier
55 * @return availability state
56 */
57 ControllerNode.State getState(NodeId nodeId);
58
tomb41d1ac2014-09-24 01:51:24 -070059 /**
Madan Jampani7d2fab22015-03-18 17:21:57 -070060 * Returns the system when the availability state was last updated.
61 *
62 * @param nodeId controller node identifier
63 * @return system time when the availability state was last updated.
64 */
65 DateTime getLastUpdated(NodeId nodeId);
66
67 /**
tomee49c372014-09-26 15:14:50 -070068 * Adds a new controller node to the cluster.
69 *
70 * @param nodeId controller node identifier
71 * @param ip node IP listen address
72 * @param tcpPort tcp listen port
73 * @return newly added node
74 */
Pavlin Radoslavov444b5192014-10-28 10:45:19 -070075 ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort);
tomee49c372014-09-26 15:14:50 -070076
77 /**
tomb41d1ac2014-09-24 01:51:24 -070078 * Removes the specified node from the inventory of cluster nodes.
79 *
80 * @param nodeId controller instance identifier
81 */
82 void removeNode(NodeId nodeId);
83
tome4729872014-09-23 00:37:37 -070084}