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;
14 * ElectionTerm contains information about a RaftActors election term.
16 * This information includes the last known current term of the RaftActor
17 * and which peer was voted for by the RaftActor in that term
19 * This class ensures that election term information is persisted
21 public interface ElectionTerm {
23 * latest term server has seen (initialized to 0
24 * on first boot, increases monotonically)
26 AtomicLong getCurrentTerm();
29 * candidateId that received vote in current
30 * term (or null if none)
35 * Called when we need to update the current term either because we received
36 * a message from someone with a more uptodate term or because we just voted
42 void update(AtomicLong currentTerm, String votedFor);