6aa76508fc2323094a497895cad4d3d7a2bdd3d0
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformationImpl.java
1 /*
2  * Copyright (c) 2014 Cisco 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
9 package org.opendaylight.controller.cluster.raft;
10
11 import java.util.concurrent.atomic.AtomicLong;
12
13 public class FollowerLogInformationImpl implements FollowerLogInformation{
14
15     private final String id;
16
17     private final AtomicLong nextIndex;
18
19     private final AtomicLong matchIndex;
20
21     public FollowerLogInformationImpl(String id, AtomicLong nextIndex,
22         AtomicLong matchIndex) {
23         this.id = id;
24         this.nextIndex = nextIndex;
25         this.matchIndex = matchIndex;
26     }
27
28     public long incrNextIndex(){
29         return nextIndex.incrementAndGet();
30     }
31
32     public long incrMatchIndex(){
33         return matchIndex.incrementAndGet();
34     }
35
36     public String getId() {
37         return id;
38     }
39
40     public AtomicLong getNextIndex() {
41         return nextIndex;
42     }
43
44     public AtomicLong getMatchIndex() {
45         return matchIndex;
46     }
47
48 }