Class SnapshotBackedReadTransaction<T>
- java.lang.Object
-
- org.opendaylight.mdsal.dom.spi.store.AbstractDOMStoreTransaction<T>
-
- org.opendaylight.mdsal.dom.spi.store.SnapshotBackedReadTransaction<T>
-
- Type Parameters:
T
- identifier type
- All Implemented Interfaces:
AutoCloseable
,DOMStoreReadTransaction
,DOMStoreTransaction
,SnapshotBackedTransaction
,Identifiable<Object>
@Beta public final class SnapshotBackedReadTransaction<T> extends AbstractDOMStoreTransaction<T> implements DOMStoreReadTransaction, SnapshotBackedTransaction
Implementation of read-only transaction backed byDataTreeSnapshot
which delegates most of its calls to similar methods provided by underlying snapshot.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SnapshotBackedReadTransaction.TransactionClosePrototype<T>
Prototype implementation ofclose()
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
FluentFuture<Boolean>
exists(YangInstanceIdentifier path)
Checks if data is available in the logical data store located at provided path.Optional<DataTreeSnapshot>
getSnapshot()
Returns theDataTreeSnapshot
underlying this transaction.FluentFuture<Optional<NormalizedNode>>
read(YangInstanceIdentifier path)
Reads data from provided logical data store located at provided path.-
Methods inherited from class org.opendaylight.mdsal.dom.spi.store.AbstractDOMStoreTransaction
addToStringAttributes, getDebugContext, getIdentifier, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction
execute
-
Methods inherited from interface org.opendaylight.mdsal.dom.spi.store.DOMStoreTransaction
getIdentifier
-
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDOMStoreTransaction
-
read
public FluentFuture<Optional<NormalizedNode>> read(YangInstanceIdentifier path)
Description copied from interface:DOMStoreReadTransaction
Reads data from provided logical data store located at provided path.- Specified by:
read
in interfaceDOMStoreReadTransaction
- Parameters:
path
- Path which uniquely identifies subtree which client want to read- Returns:
- a FluentFuture containing the result of the read. The Future blocks until the
commit operation is complete. Once complete:
- If the data at the supplied path exists, the Future returns an Optional object containing the data.
- If the data at the supplied path does not exist, the Future returns Optional.empty().
- If the read of the data fails, the Future will fail with a
ReadFailedException
or an exception derived from ReadFailedException.
-
exists
public FluentFuture<Boolean> exists(YangInstanceIdentifier path)
Description copied from interface:DOMStoreReadTransaction
Checks if data is available in the logical data store located at provided path.Note: a successful result from this method makes no guarantee that a subsequent call to
DOMStoreReadTransaction.read(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)
will succeed. It is possible that the data resides in a data store on a remote node and, if that node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if the data is deleted in between the calls toexists
andread
- Specified by:
exists
in interfaceDOMStoreReadTransaction
- Parameters:
path
- Path which uniquely identifies subtree which client want to check existence of- Returns:
- a FluentFuture containing the result of the check.
- If the data at the supplied path exists, the Future returns a Boolean whose value is true, false otherwise
- If checking for the data fails, the Future will fail with a
ReadFailedException
or an exception derived from ReadFailedException.
-
getSnapshot
public Optional<DataTreeSnapshot> getSnapshot()
Description copied from interface:SnapshotBackedTransaction
Returns theDataTreeSnapshot
underlying this transaction. If this transaction is no longer open,Optional.empty()
is returned.- Specified by:
getSnapshot
in interfaceSnapshotBackedTransaction
- Returns:
- DataTreeSnapshot attached to this transaction if this transaction is still open.
-
-