blob: 6526a1d3057639c367fe76e502221a3629218141 [file] [log] [blame]
Jordan Halterman28183ee2017-10-17 17:29:10 -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
18import java.util.Set;
19
20import org.onosproject.core.Version;
21
22import static com.google.common.base.MoreObjects.toStringHelper;
23
24/**
25 * Membership group.
26 */
27public class MembershipGroup {
28 private final Version version;
29 private final Set<Member> members;
30
31 public MembershipGroup(Version version, Set<Member> members) {
32 this.version = version;
33 this.members = members;
34 }
35
36 /**
37 * Returns the group version.
38 *
39 * @return the group version
40 */
41 public Version version() {
42 return version;
43 }
44
45 /**
46 * Returns the set of members in the group.
47 *
48 * @return the set of members in the group
49 */
50 public Set<Member> members() {
51 return members;
52 }
53
54 @Override
55 public String toString() {
56 return toStringHelper(this)
57 .add("version", version)
58 .add("members", members)
59 .toString();
60 }
61}