BUG-5280: refactor CohortEntry
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / policy / TwoNodeClusterRaftPolicy.java
1 /*
2  * Copyright (c) 2015 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.datastore.policy;
10
11 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
12
13 /**
14  * The TwoNodeClusterRaftPolicy is intended to be used in a two node deployment where when one instance
15  * of the controller goes down the other instance is to take over and move the state forward.
16  * When a TwoNodeClusterRaftPolicy is used Raft elections are disabled. This is primarily because we would
17  * need to specify the leader externally. Also since we want one node to continue to function while the other
18  * node is down we would need to apply a modification to the state before consensus occurs.
19  */
20 public class TwoNodeClusterRaftPolicy implements RaftPolicy {
21     @Override
22     public boolean automaticElectionsEnabled() {
23         return false;
24     }
25
26     @Override
27     public boolean applyModificationToStateBeforeConsensus() {
28         return true;
29     }
30 }