X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fpolicy%2FTestOnlyRaftPolicy.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fpolicy%2FTestOnlyRaftPolicy.java;h=83f9d3d277f2bc89a39f3decf6edad4163cf5df0;hp=0000000000000000000000000000000000000000;hb=e08568ddef3a5455b6b477e6672b8629f6935c20;hpb=e22f23e06c02a9a70b7c72a269df86cc2407ffc5 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/policy/TestOnlyRaftPolicy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/policy/TestOnlyRaftPolicy.java new file mode 100644 index 0000000000..83f9d3d277 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/policy/TestOnlyRaftPolicy.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.policy; + + +import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; + +/** + * A RaftPolicy that disables elections so that we can then specify exactly which Shard Replica should be + * Leader. Once a Leader is assigned it will behave as per Raft. + */ +public class TestOnlyRaftPolicy implements RaftPolicy { + @Override + public boolean automaticElectionsEnabled() { + return false; + } + + @Override + public boolean applyModificationToStateBeforeConsensus() { + return false; + } +}