Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 | |
Madan Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 18 | import org.joda.time.DateTime; |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.store.Store; |
| 21 | |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 22 | import java.util.Set; |
| 23 | |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Manages inventory of controller cluster nodes; not intended for direct use. |
| 26 | */ |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 27 | public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> { |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 30 | * Returns the local controller node. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 31 | * |
| 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 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 44 | * Returns the specified controller node. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 45 | * |
| 46 | * @param nodeId controller instance identifier |
| 47 | * @return controller instance |
| 48 | */ |
| 49 | ControllerNode getNode(NodeId nodeId); |
| 50 | |
| 51 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 52 | * Returns the availability state of the specified controller node. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 53 | * |
| 54 | * @param nodeId controller instance identifier |
| 55 | * @return availability state |
| 56 | */ |
| 57 | ControllerNode.State getState(NodeId nodeId); |
| 58 | |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 59 | /** |
Thomas Vachuska | 7a8de84 | 2016-03-07 20:56:35 -0800 | [diff] [blame] | 60 | * 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 Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 67 | * 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 | /** |
tom | ee49c37 | 2014-09-26 15:14:50 -0700 | [diff] [blame] | 75 | * 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 Radoslavov | 444b519 | 2014-10-28 10:45:19 -0700 | [diff] [blame] | 82 | ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort); |
tom | ee49c37 | 2014-09-26 15:14:50 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 85 | * Removes the specified node from the inventory of cluster nodes. |
| 86 | * |
| 87 | * @param nodeId controller instance identifier |
| 88 | */ |
| 89 | void removeNode(NodeId nodeId); |
| 90 | |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 91 | } |