Add optional timeout parameter for backup rpc
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / PeerInfo.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.raft;
9
10 /**
11  * Stores information about a raft peer.
12  *
13  * @author Thomas Pantelis
14  */
15 public class PeerInfo {
16     private final String id;
17     private String address;
18     private VotingState votingState;
19
20     /**
21      * Constructs an instance.
22      *
23      * @param id the id of the peer.
24      * @param address the address of the peer.
25      * @param votingState the VotingState of the peer.
26      */
27     public PeerInfo(String id, String address, VotingState votingState) {
28         this.id = id;
29         this.address = address;
30         this.votingState = votingState;
31     }
32
33     public String getId() {
34         return id;
35     }
36
37     public String getAddress() {
38         return address;
39     }
40
41     public VotingState getVotingState() {
42         return votingState;
43     }
44
45     public boolean isVoting() {
46         return votingState == VotingState.VOTING;
47     }
48
49     public void setAddress(String address) {
50         this.address = address;
51     }
52
53     public void setVotingState(VotingState votingState) {
54         this.votingState = votingState;
55     }
56
57     @Override
58     public String toString() {
59         return "PeerInfo [id=" + id + ", address=" + address + ", votingState=" + votingState + "]";
60     }
61 }