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.base.Optional;
12 import com.google.common.util.concurrent.SettableFuture;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 import scala.concurrent.Future;
18 * FIXME: why do we need this interface? It should be possible to integrate it with
19 * AbstractTransactionContext, which is the only implementation anyway.
21 interface TransactionContext {
22 void closeTransaction();
24 Future<ActorSelection> readyTransaction();
26 void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
28 void deleteData(YangInstanceIdentifier path);
30 void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
32 void readData(final YangInstanceIdentifier path, SettableFuture<Optional<NormalizedNode<?, ?>>> proxyFuture);
34 void dataExists(YangInstanceIdentifier path, SettableFuture<Boolean> proxyFuture);
36 boolean supportsDirectCommit();
38 Future<Object> directCommit();
41 * Invoked by {@link TransactionContextWrapper} when it has finished handing
42 * off operations to this context. From this point on, the context is responsible
43 * for throttling operations.
45 * Implementations can rely on the wrapper calling this operation in a synchronized
46 * block, so they do not need to ensure visibility of this state transition themselves.
48 void operationHandoffComplete();