2 * Copyright (c) 2014 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.mdsal.binding.api;
10 import org.opendaylight.mdsal.common.api.AsyncReadTransaction;
11 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
12 import org.opendaylight.mdsal.common.api.ReadFailedException;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import com.google.common.base.Optional;
17 import com.google.common.util.concurrent.CheckedFuture;
20 * A transaction that provides a stateful read-only view of the data tree.
22 * For more information on usage and examples, please see the documentation in
23 * {@link org.opendaylight.mdsal.common.api.AsyncReadTransaction}.
25 public interface ReadTransaction extends AsyncReadTransaction<InstanceIdentifier<?>, DataObject> {
28 * Reads data from the provided logical data store located at the provided path.
30 * If the target is a subtree, then the whole subtree is read (and will be
31 * accessible from the returned data object).
34 * Logical data store from which read should occur.
36 * Path which uniquely identifies subtree which client want to
38 * @return a CheckFuture containing the result of the read. The Future blocks until the
39 * commit operation is complete. Once complete:
41 * <li>If the data at the supplied path exists, the Future returns an Optional object
42 * containing the data.</li>
43 * <li>If the data at the supplied path does not exist, the Future returns
44 * Optional#absent().</li>
45 * <li>If the read of the data fails, the Future will fail with a
46 * {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
49 <T extends DataObject> CheckedFuture<Optional<T>,ReadFailedException> read(
50 LogicalDatastoreType store, InstanceIdentifier<T> path);