blob: e3660f3b4f42592c5414f6891b3118314ea5a1e7 [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;
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 /**
Thomas Vachuska7a8de842016-03-07 20:56:35 -080060 * Marks the current node as fully started.
61 *
62 * @param started true indicates all components have been started
63 */
64 void markFullyStarted(boolean started);
65
66 /**
Madan Jampani7d2fab22015-03-18 17:21:57 -070067 * Returns the system when the availability state was last updated.
68 *
69 * @param nodeId controller node identifier
70 * @return system time when the availability state was last updated.
71 */
72 DateTime getLastUpdated(NodeId nodeId);
73
74 /**
tomee49c372014-09-26 15:14:50 -070075 * Adds a new controller node to the cluster.
76 *
77 * @param nodeId controller node identifier
78 * @param ip node IP listen address
79 * @param tcpPort tcp listen port
80 * @return newly added node
81 */
Pavlin Radoslavov444b5192014-10-28 10:45:19 -070082 ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort);
tomee49c372014-09-26 15:14:50 -070083
84 /**
tomb41d1ac2014-09-24 01:51:24 -070085 * Removes the specified node from the inventory of cluster nodes.
86 *
87 * @param nodeId controller instance identifier
88 */
89 void removeNode(NodeId nodeId);
90
tome4729872014-09-23 00:37:37 -070091}