Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | */ |
| 16 | package org.onosproject.cluster; |
| 17 | |
| 18 | import java.util.Set; |
| 19 | |
| 20 | import org.joda.time.DateTime; |
| 21 | import org.onosproject.core.Version; |
| 22 | import org.onosproject.event.ListenerService; |
| 23 | |
| 24 | /** |
| 25 | * Service for obtaining information about the individual nodes within |
| 26 | * the controller cluster. |
| 27 | */ |
| 28 | public interface MembershipService |
| 29 | extends ListenerService<ClusterEvent, ClusterEventListener> { |
| 30 | |
| 31 | /** |
| 32 | * Returns the local controller node. |
| 33 | * |
| 34 | * @return local controller node |
| 35 | */ |
| 36 | ControllerNode getLocalNode(); |
| 37 | |
| 38 | /** |
| 39 | * Returns the set of current cluster members. |
| 40 | * |
| 41 | * @return set of cluster members |
| 42 | */ |
| 43 | Set<ControllerNode> getNodes(); |
| 44 | |
| 45 | /** |
| 46 | * Returns the specified controller node. |
| 47 | * |
| 48 | * @param nodeId controller node identifier |
| 49 | * @return controller node |
| 50 | */ |
| 51 | ControllerNode getNode(NodeId nodeId); |
| 52 | |
| 53 | /** |
| 54 | * Returns the availability state of the specified controller node. Note |
| 55 | * that this does not imply that all the core and application components |
| 56 | * have been fully activated; only that the node has joined the cluster. |
| 57 | * |
| 58 | * @param nodeId controller node identifier |
| 59 | * @return availability state |
| 60 | */ |
| 61 | ControllerNode.State getState(NodeId nodeId); |
| 62 | |
| 63 | /** |
| 64 | * Returns the version of the given controller node. |
| 65 | * |
| 66 | * @param nodeId controller node identifier |
| 67 | * @return controller version |
| 68 | */ |
| 69 | Version getVersion(NodeId nodeId); |
| 70 | |
| 71 | /** |
| 72 | * Returns the system time when the availability state was last updated. |
| 73 | * |
| 74 | * @param nodeId controller node identifier |
| 75 | * @return system time when the availability state was last updated. |
| 76 | */ |
| 77 | DateTime getLastUpdated(NodeId nodeId); |
| 78 | |
| 79 | } |