2 * Copyright (c) 2015 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
8 package org.opendaylight.controller.cluster.datastore;
10 import akka.actor.ActorSelection;
11 import com.google.common.util.concurrent.SettableFuture;
12 import org.opendaylight.controller.cluster.datastore.messages.AbstractRead;
13 import org.opendaylight.controller.cluster.datastore.modification.AbstractModification;
14 import scala.concurrent.Future;
17 * FIXME: why do we need this interface? It should be possible to integrate it with
18 * AbstractTransactionContext, which is the only implementation anyway.
20 interface TransactionContext {
21 void closeTransaction();
23 Future<ActorSelection> readyTransaction(Boolean havePermit);
25 void executeModification(AbstractModification modification, Boolean havePermit);
27 <T> void executeRead(AbstractRead<T> readCmd, SettableFuture<T> promise, Boolean havePermit);
29 Future<Object> directCommit(Boolean havePermit);
32 * Invoked by {@link TransactionContextWrapper} when it has finished handing
33 * off operations to this context. From this point on, the context is responsible
34 * for throttling operations.
37 * Implementations can rely on the wrapper calling this operation in a synchronized
38 * block, so they do not need to ensure visibility of this state transition themselves.
40 void operationHandOffComplete();
43 * A TransactionContext that uses operation limiting should return true else false.
45 * @return true if operation limiting is used, false otherwise
47 boolean usesOperationLimiting();
49 short getTransactionVersion();