blob: 0a4ac585fe1b03ba32ad1f5d8e6c7a7a36443f09 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
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 */
tome4729872014-09-23 00:37:37 -070016package org.onlab.onos.cluster;
17
tom0755a362014-09-24 11:54:43 -070018import org.onlab.onos.store.Store;
Pavlin Radoslavov444b5192014-10-28 10:45:19 -070019import org.onlab.packet.IpAddress;
tom0755a362014-09-24 11:54:43 -070020
tome4729872014-09-23 00:37:37 -070021import java.util.Set;
22
23/**
24 * Manages inventory of controller cluster nodes; not intended for direct use.
25 */
tom0755a362014-09-24 11:54:43 -070026public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> {
tome4729872014-09-23 00:37:37 -070027
28 /**
tomb41d1ac2014-09-24 01:51:24 -070029 * Returns the local controller node.
tome4729872014-09-23 00:37:37 -070030 *
31 * @return local controller instance
32 */
33 ControllerNode getLocalNode();
34
35 /**
36 * Returns the set of current cluster members.
37 *
38 * @return set of cluster members
39 */
40 Set<ControllerNode> getNodes();
41
42 /**
tomb41d1ac2014-09-24 01:51:24 -070043 * Returns the specified controller node.
tome4729872014-09-23 00:37:37 -070044 *
45 * @param nodeId controller instance identifier
46 * @return controller instance
47 */
48 ControllerNode getNode(NodeId nodeId);
49
50 /**
tomb41d1ac2014-09-24 01:51:24 -070051 * Returns the availability state of the specified controller node.
tome4729872014-09-23 00:37:37 -070052 *
53 * @param nodeId controller instance identifier
54 * @return availability state
55 */
56 ControllerNode.State getState(NodeId nodeId);
57
tomb41d1ac2014-09-24 01:51:24 -070058 /**
tomee49c372014-09-26 15:14:50 -070059 * Adds a new controller node to the cluster.
60 *
61 * @param nodeId controller node identifier
62 * @param ip node IP listen address
63 * @param tcpPort tcp listen port
64 * @return newly added node
65 */
Pavlin Radoslavov444b5192014-10-28 10:45:19 -070066 ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort);
tomee49c372014-09-26 15:14:50 -070067
68 /**
tomb41d1ac2014-09-24 01:51:24 -070069 * Removes the specified node from the inventory of cluster nodes.
70 *
71 * @param nodeId controller instance identifier
72 */
73 void removeNode(NodeId nodeId);
74
tome4729872014-09-23 00:37:37 -070075}