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 | |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 18 | import java.util.Collection; |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 19 | import java.util.Set; |
| 20 | |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 21 | import org.onosproject.core.Version; |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 24 | * Service for obtaining information about the individual members of the controller cluster. |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 25 | */ |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 26 | public interface MembershipService { |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 29 | * Returns the local member. |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 30 | * |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 31 | * @return local member |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 32 | */ |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 33 | Member getLocalMember(); |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 36 | * Returns the group associated with the local member. |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 37 | * |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 38 | * @return the group associated with the local member |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 39 | */ |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 40 | MembershipGroup getLocalGroup(); |
| 41 | |
| 42 | /** |
| 43 | * Returns the set of current cluster members in the local group. |
| 44 | * |
| 45 | * @return set of cluster members in the local group |
| 46 | */ |
| 47 | Set<Member> getMembers(); |
| 48 | |
| 49 | /** |
| 50 | * Returns the set of membership groups in the cluster. |
| 51 | * |
| 52 | * @return the set of membership groups in the cluster |
| 53 | */ |
| 54 | Collection<MembershipGroup> getGroups(); |
| 55 | |
| 56 | /** |
| 57 | * Returns the membership group for the given version. |
| 58 | * |
| 59 | * @param version the version for which to return the membership group |
| 60 | * @return the membership group for the given version |
| 61 | */ |
| 62 | MembershipGroup getGroup(Version version); |
| 63 | |
| 64 | /** |
| 65 | * Returns the set of members in the given version. |
| 66 | * |
| 67 | * @param version the version for which to return the set of members |
| 68 | * @return the set of members for the given version |
| 69 | */ |
| 70 | Set<Member> getMembers(Version version); |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Returns the specified controller node. |
| 74 | * |
| 75 | * @param nodeId controller node identifier |
| 76 | * @return controller node |
| 77 | */ |
Jordan Halterman | 28183ee | 2017-10-17 17:29:10 -0700 | [diff] [blame] | 78 | Member getMember(NodeId nodeId); |
Jordan Halterman | 980a8c1 | 2017-09-22 18:01:19 -0700 | [diff] [blame] | 79 | |
| 80 | } |