blob: e33c0b427d71c92c546c2de9a3bf188ca79d08a6 [file] [log] [blame]
Madan Jampaniccdf9da2016-05-05 14:37:27 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Madan Jampaniccdf9da2016-05-05 14:37:27 -07003 *
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.store.service;
17
18import java.util.Collection;
19
20import org.onosproject.cluster.NodeId;
21import org.onosproject.cluster.PartitionId;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070022
23import com.google.common.collect.ImmutableList;
24
25import static com.google.common.base.Preconditions.checkNotNull;
26
27/**
28 * Contains information about a database partition client.
29 */
30public class PartitionClientInfo {
31 private final PartitionId partitionId;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070032 private final Collection<NodeId> servers;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070033
Jordan Halterman2bf177c2017-06-29 01:49:08 -070034 public PartitionClientInfo(PartitionId partitionId, Collection<NodeId> servers) {
Madan Jampaniccdf9da2016-05-05 14:37:27 -070035 this.partitionId = checkNotNull(partitionId);
36 this.servers = ImmutableList.copyOf(checkNotNull(servers));
Madan Jampaniccdf9da2016-05-05 14:37:27 -070037 }
38
39 /**
40 * Returns the identifier for the partition.
41 *
42 * @return partition id
43 */
44 public PartitionId partitionId() {
45 return partitionId;
46 }
47
48 /**
49 * Returns the collection of servers that are members of the partition.
50 *
51 * @return active members of the partition
52 */
53 public Collection<NodeId> servers() {
54 return servers;
55 }
Madan Jampaniccdf9da2016-05-05 14:37:27 -070056}