blob: 8b4a8fd3ee69c1014391f3c0b923f4c05df9f1d7 [file] [log] [blame]
Jonathan Hart054da972015-02-18 17:30:28 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Jonathan Hart054da972015-02-18 17:30:28 -08003 *
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 com.google.common.collect.ImmutableList;
19
20import java.util.List;
21
22/**
23 * Contains information about a database partition.
24 */
25public class PartitionInfo {
26 private final String name;
27 private final long term;
28 private final List<String> members;
29 private final String leader;
30
31 /**
32 * Class constructor.
33 *
34 * @param name partition name
35 * @param term term number
36 * @param members partition members
37 * @param leader leader name
38 */
39 public PartitionInfo(String name, long term, List<String> members, String leader) {
40 this.name = name;
41 this.term = term;
42 this.members = ImmutableList.copyOf(members);
43 this.leader = leader;
44 }
45
46 /**
47 * Returns the name of the partition.
48 *
49 * @return partition name
50 */
51 public String name() {
52 return name;
53 }
54
55 /**
56 * Returns the term number.
57 *
58 * @return term number
59 */
60 public long term() {
61 return term;
62 }
63
64 /**
65 * Returns the list of partition members.
66 *
67 * @return partition members
68 */
69 public List<String> members() {
70 return members;
71 }
72
73 /**
74 * Returns the partition leader.
75 *
76 * @return partition leader
77 */
78 public String leader() {
79 return leader;
80 }
81}