34c786c7ac0dc94708b580132fb55ef2f923db23
[mdsal.git] / binding2 / mdsal-binding2-api / src / main / java / org / opendaylight / mdsal / binding / javav2 / api / ReadTransaction.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.mdsal.binding.javav2.api;
10
11 import com.google.common.annotations.Beta;
12 import java.util.function.BiConsumer;
13 import org.opendaylight.mdsal.binding.javav2.spec.base.InstanceIdentifier;
14 import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
15 import org.opendaylight.mdsal.common.api.AsyncReadTransaction;
16 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
17 import org.opendaylight.mdsal.common.api.ReadFailedException;
18
19 /**
20  * A transaction that provides a stateful read-only view of the data tree.
21  *
22  * <p>
23  * For more information on usage and examples, please see the documentation in
24  *  {@link org.opendaylight.mdsal.common.api.AsyncReadTransaction}.
25  */
26 @Beta
27 public interface ReadTransaction extends Transaction, AsyncReadTransaction<InstanceIdentifier<?>, TreeNode> {
28
29     /**
30      * Reads data from the provided logical data store located at the provided path.
31      *
32      *<p>
33      * If the target is a subtree, then the whole subtree is read (and will be
34      * accessible from the returned data object).
35      *
36      * @param store
37      *            Logical data store from which read should occur.
38      * @param path
39      *            Path which uniquely identifies subtree which client want to
40      *            read
41      * @param callback result callback
42      * @param <T> result type
43      */
44     <T extends TreeNode> void read(LogicalDatastoreType store, InstanceIdentifier<T> path,
45         BiConsumer<ReadFailedException, T> callback);
46 }