blob: ca97060226001a26cae01d6ceda58562053084b7 [file] [log] [blame]
Madan Jampaniccdf9da2016-05-05 14:37:27 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
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.store.service;
17
18import java.util.Collection;
19
20import org.onosproject.cluster.NodeId;
21import org.onosproject.cluster.PartitionId;
22import org.onosproject.store.service.DistributedPrimitive.Status;
23
24import com.google.common.collect.ImmutableList;
25
26import static com.google.common.base.Preconditions.checkNotNull;
27
28/**
29 * Contains information about a database partition client.
30 */
31public class PartitionClientInfo {
32 private final PartitionId partitionId;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070033 private final Collection<NodeId> servers;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070034
Jordan Halterman2bf177c2017-06-29 01:49:08 -070035 public PartitionClientInfo(PartitionId partitionId, Collection<NodeId> servers) {
Madan Jampaniccdf9da2016-05-05 14:37:27 -070036 this.partitionId = checkNotNull(partitionId);
37 this.servers = ImmutableList.copyOf(checkNotNull(servers));
Madan Jampaniccdf9da2016-05-05 14:37:27 -070038 }
39
40 /**
41 * Returns the identifier for the partition.
42 *
43 * @return partition id
44 */
45 public PartitionId partitionId() {
46 return partitionId;
47 }
48
49 /**
50 * Returns the collection of servers that are members of the partition.
51 *
52 * @return active members of the partition
53 */
54 public Collection<NodeId> servers() {
55 return servers;
56 }
57
58 /**
59 * Return the sessionId for the partition client.
60 * @return session id
Jordan Halterman2bf177c2017-06-29 01:49:08 -070061 * @deprecated in Loon release (1.11.0)
Madan Jampaniccdf9da2016-05-05 14:37:27 -070062 */
Jordan Halterman2bf177c2017-06-29 01:49:08 -070063 @Deprecated
Madan Jampaniccdf9da2016-05-05 14:37:27 -070064 public long sessionId() {
Jordan Halterman2bf177c2017-06-29 01:49:08 -070065 return 0;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070066 }
67
68 /**
69 * Returns the current status for the client session.
70 * @return status
Jordan Halterman2bf177c2017-06-29 01:49:08 -070071 * @deprecated in Loon release (1.11.0)
Madan Jampaniccdf9da2016-05-05 14:37:27 -070072 */
Jordan Halterman2bf177c2017-06-29 01:49:08 -070073 @Deprecated
Madan Jampaniccdf9da2016-05-05 14:37:27 -070074 public Status status() {
Jordan Halterman2bf177c2017-06-29 01:49:08 -070075 return null;
Madan Jampaniccdf9da2016-05-05 14:37:27 -070076 }
77}