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