Split out TransactionContext classes
[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.CheckedFuture;
13 import java.util.List;
14 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 import scala.concurrent.Future;
18
19 /*
20  * FIXME: why do we need this interface? It should be possible to integrate it with
21  *        AbstractTransactionContext, which is the only implementation anyway.
22  */
23 interface TransactionContext {
24     void closeTransaction();
25
26     Future<ActorSelection> readyTransaction();
27
28     void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
29
30     void deleteData(YangInstanceIdentifier path);
31
32     void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
33
34     CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readData(
35             final YangInstanceIdentifier path);
36
37     CheckedFuture<Boolean, ReadFailedException> dataExists(YangInstanceIdentifier path);
38
39     List<Future<Object>> getRecordedOperationFutures();
40 }