Refactor TransactionProxy
[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.base.Optional;
12 import com.google.common.util.concurrent.SettableFuture;
13 import java.util.List;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
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();
26
27     void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
28
29     void deleteData(YangInstanceIdentifier path);
30
31     void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
32
33     void readData(final YangInstanceIdentifier path, SettableFuture<Optional<NormalizedNode<?, ?>>> proxyFuture);
34
35     void dataExists(YangInstanceIdentifier path, SettableFuture<Boolean> proxyFuture);
36
37     List<Future<Object>> getRecordedOperationFutures();
38 }