blob: f56daf59327ec3a16faba8ed3083cfdc21efb08a [file] [log] [blame]
Jordan Halterman980a8c12017-09-22 18:01:19 -07001/*
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 */
16package org.onosproject.cluster;
17
Jordan Halterman28183ee2017-10-17 17:29:10 -070018import java.util.Collection;
Jordan Halterman980a8c12017-09-22 18:01:19 -070019import java.util.Set;
20
Jordan Halterman980a8c12017-09-22 18:01:19 -070021import org.onosproject.core.Version;
Jordan Halterman980a8c12017-09-22 18:01:19 -070022
23/**
Jordan Halterman28183ee2017-10-17 17:29:10 -070024 * Service for obtaining information about the individual members of the controller cluster.
Jordan Halterman980a8c12017-09-22 18:01:19 -070025 */
Jordan Halterman28183ee2017-10-17 17:29:10 -070026public interface MembershipService {
Jordan Halterman980a8c12017-09-22 18:01:19 -070027
28 /**
Jordan Halterman28183ee2017-10-17 17:29:10 -070029 * Returns the local member.
Jordan Halterman980a8c12017-09-22 18:01:19 -070030 *
Jordan Halterman28183ee2017-10-17 17:29:10 -070031 * @return local member
Jordan Halterman980a8c12017-09-22 18:01:19 -070032 */
Jordan Halterman28183ee2017-10-17 17:29:10 -070033 Member getLocalMember();
Jordan Halterman980a8c12017-09-22 18:01:19 -070034
35 /**
Jordan Halterman28183ee2017-10-17 17:29:10 -070036 * Returns the group associated with the local member.
Jordan Halterman980a8c12017-09-22 18:01:19 -070037 *
Jordan Halterman28183ee2017-10-17 17:29:10 -070038 * @return the group associated with the local member
Jordan Halterman980a8c12017-09-22 18:01:19 -070039 */
Jordan Halterman28183ee2017-10-17 17:29:10 -070040 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 Halterman980a8c12017-09-22 18:01:19 -070071
72 /**
73 * Returns the specified controller node.
74 *
75 * @param nodeId controller node identifier
76 * @return controller node
77 */
Jordan Halterman28183ee2017-10-17 17:29:10 -070078 Member getMember(NodeId nodeId);
Jordan Halterman980a8c12017-09-22 18:01:19 -070079
80}