Add UnsignedLongRangeSet.toString()
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / TransactionContext.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 package org.opendaylight.controller.cluster.datastore;
9
10 import akka.actor.ActorSelection;
11 import com.google.common.util.concurrent.SettableFuture;
12 import java.util.Optional;
13 import java.util.SortedSet;
14 import org.opendaylight.controller.cluster.datastore.messages.AbstractRead;
15 import org.opendaylight.controller.cluster.datastore.modification.AbstractModification;
16 import scala.concurrent.Future;
17
18 /*
19  * FIXME: why do we need this interface? It should be possible to integrate it with
20  *        AbstractTransactionContext, which is the only implementation anyway.
21  */
22 interface TransactionContext {
23     void closeTransaction();
24
25     Future<ActorSelection> readyTransaction(Boolean havePermit, Optional<SortedSet<String>> participatingShardNames);
26
27     void executeModification(AbstractModification modification, Boolean havePermit);
28
29     <T> void executeRead(AbstractRead<T> readCmd, SettableFuture<T> promise, Boolean havePermit);
30
31     Future<Object> directCommit(Boolean havePermit);
32
33     /**
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.
37      *
38      * <p>
39      * Implementations can rely on the wrapper calling this operation in a synchronized
40      * block, so they do not need to ensure visibility of this state transition themselves.
41      */
42     void operationHandOffComplete();
43
44     /**
45      * A TransactionContext that uses operation limiting should return true else false.
46      *
47      * @return true if operation limiting is used, false otherwise
48      */
49     boolean usesOperationLimiting();
50
51     short getTransactionVersion();
52 }