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 ElectionTermImpl implements ElectionTerm{
15 * Identifier of the actor whose election term information this is
17 private final String id;
19 private AtomicLong currentTerm;
21 private String votedFor;
23 public ElectionTermImpl(String id) {
26 // TODO: Read currentTerm from some persistent state
27 currentTerm = new AtomicLong(0);
29 // TODO: Read votedFor from some file
33 public AtomicLong getCurrentTerm() {
37 public String getVotedFor() {
41 public void update(AtomicLong currentTerm, String votedFor){
42 this.currentTerm = currentTerm;
43 this.votedFor = votedFor;
45 // TODO : Write to some persistent state