Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.cluster; |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.store.Store; |
Pavlin Radoslavov | 444b519 | 2014-10-28 10:45:19 -0700 | [diff] [blame] | 19 | import org.onlab.packet.IpAddress; |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 20 | |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 21 | import java.util.Set; |
| 22 | |
| 23 | /** |
| 24 | * Manages inventory of controller cluster nodes; not intended for direct use. |
| 25 | */ |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 26 | public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> { |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 29 | * Returns the local controller node. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 30 | * |
| 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 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 43 | * Returns the specified controller node. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 44 | * |
| 45 | * @param nodeId controller instance identifier |
| 46 | * @return controller instance |
| 47 | */ |
| 48 | ControllerNode getNode(NodeId nodeId); |
| 49 | |
| 50 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 51 | * Returns the availability state of the specified controller node. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 52 | * |
| 53 | * @param nodeId controller instance identifier |
| 54 | * @return availability state |
| 55 | */ |
| 56 | ControllerNode.State getState(NodeId nodeId); |
| 57 | |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 58 | /** |
tom | ee49c37 | 2014-09-26 15:14:50 -0700 | [diff] [blame] | 59 | * 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 Radoslavov | 444b519 | 2014-10-28 10:45:19 -0700 | [diff] [blame] | 66 | ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort); |
tom | ee49c37 | 2014-09-26 15:14:50 -0700 | [diff] [blame] | 67 | |
| 68 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 69 | * Removes the specified node from the inventory of cluster nodes. |
| 70 | * |
| 71 | * @param nodeId controller instance identifier |
| 72 | */ |
| 73 | void removeNode(NodeId nodeId); |
| 74 | |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 75 | } |