2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.cluster.raft;
11 import java.util.concurrent.atomic.AtomicLong;
13 public class FollowerLogInformationImpl implements FollowerLogInformation{
15 private final String id;
17 private final AtomicLong nextIndex;
19 private final AtomicLong matchIndex;
21 public FollowerLogInformationImpl(String id, AtomicLong nextIndex,
22 AtomicLong matchIndex) {
24 this.nextIndex = nextIndex;
25 this.matchIndex = matchIndex;
28 public long incrNextIndex(){
29 return nextIndex.incrementAndGet();
32 @Override public long decrNextIndex() {
33 return nextIndex.decrementAndGet();
36 @Override public void setNextIndex(long nextIndex) {
37 this.nextIndex.set(nextIndex);
40 public long incrMatchIndex(){
41 return matchIndex.incrementAndGet();
44 @Override public void setMatchIndex(long matchIndex) {
45 this.matchIndex.set(matchIndex);
48 public String getId() {
52 public AtomicLong getNextIndex() {
56 public AtomicLong getMatchIndex() {