Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 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.store.service; |
| 17 | |
| 18 | import java.util.Collection; |
| 19 | |
| 20 | import org.onosproject.cluster.NodeId; |
| 21 | import org.onosproject.cluster.PartitionId; |
| 22 | import org.onosproject.store.service.DistributedPrimitive.Status; |
| 23 | |
| 24 | import com.google.common.collect.ImmutableList; |
| 25 | |
| 26 | import static com.google.common.base.Preconditions.checkNotNull; |
| 27 | |
| 28 | /** |
| 29 | * Contains information about a database partition client. |
| 30 | */ |
| 31 | public class PartitionClientInfo { |
| 32 | private final PartitionId partitionId; |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 33 | private final Collection<NodeId> servers; |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 34 | |
Jordan Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 35 | public PartitionClientInfo(PartitionId partitionId, Collection<NodeId> servers) { |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 36 | this.partitionId = checkNotNull(partitionId); |
| 37 | this.servers = ImmutableList.copyOf(checkNotNull(servers)); |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 38 | } |
| 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 Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 61 | * @deprecated in Loon release (1.11.0) |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 62 | */ |
Jordan Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 63 | @Deprecated |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 64 | public long sessionId() { |
Jordan Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 65 | return 0; |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Returns the current status for the client session. |
| 70 | * @return status |
Jordan Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 71 | * @deprecated in Loon release (1.11.0) |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 72 | */ |
Jordan Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 73 | @Deprecated |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 74 | public Status status() { |
Jordan Halterman | 2bf177c | 2017-06-29 01:49:08 -0700 | [diff] [blame] | 75 | return null; |
Madan Jampani | ccdf9da | 2016-05-05 14:37:27 -0700 | [diff] [blame] | 76 | } |
| 77 | } |