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();
25 void executeModification(AbstractModification modification);
27 <T> void executeRead(AbstractRead<T> readCmd, SettableFuture<T> promise);
29 boolean supportsDirectCommit();
31 Future<Object> directCommit();
34 * Invoked by {@link TransactionContextWrapper} when it has finished handing
35 * off operations to this context. From this point on, the context is responsible
36 * for throttling operations.
38 * Implementations can rely on the wrapper calling this operation in a synchronized
39 * block, so they do not need to ensure visibility of this state transition themselves.
41 void operationHandOffComplete();
44 * A TransactionContext that uses Operation limiting should return true else false
47 boolean usesOperationLimiting();
49 short getTransactionVersion();