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 | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 17 | |
| 18 | import java.util.Set; |
| 19 | |
Madan Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 20 | import org.joda.time.DateTime; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 21 | import org.onosproject.event.ListenerService; |
Madan Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 22 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 23 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 24 | * Service for obtaining information about the individual nodes within |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 25 | * the controller cluster. |
| 26 | */ |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 27 | public interface ClusterService |
| 28 | extends ListenerService<ClusterEvent, ClusterEventListener> { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 29 | |
| 30 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 31 | * Returns the local controller node. |
| 32 | * |
| 33 | * @return local controller node |
| 34 | */ |
| 35 | ControllerNode getLocalNode(); |
| 36 | |
| 37 | /** |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 38 | * Returns the set of current cluster members. |
| 39 | * |
| 40 | * @return set of cluster members |
| 41 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 42 | Set<ControllerNode> getNodes(); |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 45 | * Returns the specified controller node. |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 46 | * |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 47 | * @param nodeId controller node identifier |
| 48 | * @return controller node |
| 49 | */ |
| 50 | ControllerNode getNode(NodeId nodeId); |
| 51 | |
| 52 | /** |
Thomas Vachuska | 7a8de84 | 2016-03-07 20:56:35 -0800 | [diff] [blame] | 53 | * Returns the availability state of the specified controller node. Note |
| 54 | * that this does not imply that all the core and application components |
| 55 | * have been fully activated; only that the node has joined the cluster. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 56 | * |
| 57 | * @param nodeId controller node identifier |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 58 | * @return availability state |
| 59 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 60 | ControllerNode.State getState(NodeId nodeId); |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 61 | |
tom | fc9a4ff | 2014-09-22 18:22:47 -0700 | [diff] [blame] | 62 | /** |
Madan Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 63 | * Returns the system time when the availability state was last updated. |
| 64 | * |
| 65 | * @param nodeId controller node identifier |
| 66 | * @return system time when the availability state was last updated. |
| 67 | */ |
| 68 | DateTime getLastUpdated(NodeId nodeId); |
| 69 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 70 | } |