Bug 6714 - Use singleton service in clustered netconf topology
[netconf.git] / netconf / netconf-topology-singleton / src / main / java / org / opendaylight / netconf / topology / singleton / api / NetconfDOMTransaction.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.netconf.topology.singleton.api;
10
11 import com.google.common.base.Optional;
12 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
13 import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import scala.concurrent.Future;
16
17 /**
18  * Provides API for all operations of read and write transactions
19  */
20 public interface NetconfDOMTransaction {
21
22     /**
23      * Read data from particular data-store
24      * @param store data-store type
25      * @param path unique identifier of a particular node instance in the data tree
26      * @return result as future
27      */
28     Future<Optional<NormalizedNodeMessage>> read(LogicalDatastoreType store, YangInstanceIdentifier path);
29
30     /**
31      * Test existence of node in certain data-store
32      * @param store data-store type
33      * @param path unique identifier of a particular node instance in the data tree
34      * @return result as future
35      */
36     Future<Boolean> exists(LogicalDatastoreType store, YangInstanceIdentifier path);
37
38     /**
39      * Put data to particular data-store
40      * @param store data-store type
41      * @param data data for inserting included in NormalizedNodeMessage object
42      */
43     void put(LogicalDatastoreType store, NormalizedNodeMessage data);
44
45     /**
46      * Merge data with existing node in particular data-store
47      * @param store data-store type
48      * @param data data for merging included in NormalizedNodeMessage object
49      */
50     void merge(LogicalDatastoreType store, NormalizedNodeMessage data);
51
52     /**
53      * Delete node in particular data-store in path
54      * @param store data-store type
55      * @param path unique identifier of a particular node instance in the data tree
56      */
57     void delete(LogicalDatastoreType store, YangInstanceIdentifier path);
58
59     /**
60      * Cancel operation
61      * @return success or not
62      */
63     boolean cancel();
64
65     /**
66      * Commit opened transaction.
67      * @return void or raised exception
68      */
69     Future<Void> submit();
70 }