Package org.onosproject.store.service
Interface AsyncDocumentTree<V>
- 
- Type Parameters:
- V- document tree value type
 - All Superinterfaces:
- DistributedPrimitive,- Transactional<NodeUpdate<V>>
 
 @NotThreadSafe public interface AsyncDocumentTree<V> extends DistributedPrimitive, Transactional<NodeUpdate<V>> A hierarchical document tree data structure.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.onosproject.store.service.DistributedPrimitiveDistributedPrimitive.Status, DistributedPrimitive.Type
 
- 
 - 
Field Summary- 
Fields inherited from interface org.onosproject.store.service.DistributedPrimitiveDEFAULT_OPERATION_TIMEOUT_MILLIS
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>addListener(DocumentPath path, DocumentTreeListener<V> listener)Registers a listener to be notified when the subtree rooted at the specified path is modified.default java.util.concurrent.CompletableFuture<java.lang.Void>addListener(DocumentTreeListener<V> listener)Registers a listener to be notified when the tree is modified.default DocumentTree<V>asDocumentTree()Returns a newDocumentTreethat is backed by this instance.default DocumentTree<V>asDocumentTree(long timeoutMillis)Returns a newDocumentTreethat is backed by this instance.java.util.concurrent.CompletableFuture<java.lang.Boolean>create(DocumentPath path, V value)Creates a document tree node if one does not exist already.java.util.concurrent.CompletableFuture<java.lang.Boolean>createRecursive(DocumentPath path, V value)Creates a document tree node recursively by creating all missing intermediate nodes in the path.java.util.concurrent.CompletableFuture<Versioned<V>>get(DocumentPath path)Returns the value of the tree node at specified path.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,Versioned<V>>>getChildren(DocumentPath path)Returns the children of node at specified path in the form of a mapping from child name to child value.default DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.java.util.concurrent.CompletableFuture<java.lang.Void>removeListener(DocumentTreeListener<V> listener)Unregisters a previously added listener.java.util.concurrent.CompletableFuture<Versioned<V>>removeNode(DocumentPath path)Removes the node with the specified path.java.util.concurrent.CompletableFuture<java.lang.Boolean>replace(DocumentPath path, V newValue, long version)Conditionally updates a tree node if the current version matches a specified version.java.util.concurrent.CompletableFuture<java.lang.Boolean>replace(DocumentPath path, V newValue, V currentValue)Conditionally updates a tree node if the current node value matches a specified version.DocumentPathroot()Returns thepathto root of the tree.java.util.concurrent.CompletableFuture<Versioned<V>>set(DocumentPath path, V value)Creates or updates a document tree node.- 
Methods inherited from interface org.onosproject.store.service.DistributedPrimitiveaddStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
 - 
Methods inherited from interface org.onosproject.store.service.Transactionalbegin, commit, prepare, prepareAndCommit, rollback
 
- 
 
- 
- 
- 
Method Detail- 
primitiveTypedefault DistributedPrimitive.Type primitiveType() Description copied from interface:DistributedPrimitiveReturns the type of primitive.- Specified by:
- primitiveTypein interface- DistributedPrimitive
- Returns:
- primitive type
 
 - 
rootDocumentPath root() Returns thepathto root of the tree.- Returns:
- path to root of the tree
 
 - 
getChildrenjava.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,Versioned<V>>> getChildren(DocumentPath path) Returns the children of node at specified path in the form of a mapping from child name to child value.- Parameters:
- path- path to the node
- Returns:
- future for mapping from child name to child value
- Throws:
- NoSuchDocumentPathException- if the path does not point to a valid node
 
 - 
getjava.util.concurrent.CompletableFuture<Versioned<V>> get(DocumentPath path) Returns the value of the tree node at specified path.- Parameters:
- path- path to the node
- Returns:
- future that will be either be completed with node's versionedvalue ornullif path does not point to a valid node
 
 - 
setjava.util.concurrent.CompletableFuture<Versioned<V>> set(DocumentPath path, V value) Creates or updates a document tree node.- Parameters:
- path- path to the node
- value- value to be associated with the node (- nullis a valid value)
- Returns:
- future that will either be completed with the previous versionedvalue ornullif there was no node previously at that path. Future will be completed with aIllegalDocumentModificationExceptionif the parent node (for the node to create/update) does not exist
 
 - 
createjava.util.concurrent.CompletableFuture<java.lang.Boolean> create(DocumentPath path, V value) Creates a document tree node if one does not exist already.- Parameters:
- path- path to the node
- value- the non-null value to be associated with the node
- Returns:
- future that is completed with trueif the new node was successfully created. Future will be completed withfalseif a node already exists at the specified path. Future will be completed exceptionally with aIllegalDocumentModificationExceptionif the parent node (for the node to create) does not exist
 
 - 
createRecursivejava.util.concurrent.CompletableFuture<java.lang.Boolean> createRecursive(DocumentPath path, V value) Creates a document tree node recursively by creating all missing intermediate nodes in the path.- Parameters:
- path- path to the node
- value- value to be associated with the node (- nullis a valid value)
- Returns:
- future that is completed with trueif the new node was successfully created. Future will be completed withfalseif a node already exists at the specified path
 
 - 
replacejava.util.concurrent.CompletableFuture<java.lang.Boolean> replace(DocumentPath path, V newValue, long version) Conditionally updates a tree node if the current version matches a specified version.- Parameters:
- path- path to the node
- newValue- value to associate with the node (- nullis a valid value)
- version- current version of the node for update to occur
- Returns:
- future that is either completed with trueif the update was made orfalseif update did not happen
 
 - 
replacejava.util.concurrent.CompletableFuture<java.lang.Boolean> replace(DocumentPath path, V newValue, V currentValue) Conditionally updates a tree node if the current node value matches a specified version.- Parameters:
- path- path to the node
- newValue- value to associate with the node (- nullis a valid value)
- currentValue- current value of the node for update to occur
- Returns:
- future that is either completed with trueif the update was made orfalseif update did not happen
 
 - 
removeNodejava.util.concurrent.CompletableFuture<Versioned<V>> removeNode(DocumentPath path) Removes the node with the specified path.- Parameters:
- path- path to the node
- Returns:
- future for the previous value. Future will be completed with a
 IllegalDocumentModificationExceptionif the node to be removed is either the root node or has one or more children. Future will be completed with aNoSuchDocumentPathExceptionif the node to be removed does not exist
 
 - 
addListenerjava.util.concurrent.CompletableFuture<java.lang.Void> addListener(DocumentPath path, DocumentTreeListener<V> listener) Registers a listener to be notified when the subtree rooted at the specified path is modified.- Parameters:
- path- path to the node
- listener- listener to be notified
- Returns:
- a future that is completed when the operation completes
 
 - 
removeListenerjava.util.concurrent.CompletableFuture<java.lang.Void> removeListener(DocumentTreeListener<V> listener) Unregisters a previously added listener.- Parameters:
- listener- listener to unregister
- Returns:
- a future that is completed when the operation completes
 
 - 
addListenerdefault java.util.concurrent.CompletableFuture<java.lang.Void> addListener(DocumentTreeListener<V> listener) Registers a listener to be notified when the tree is modified.- Parameters:
- listener- listener to be notified
- Returns:
- a future that is completed when the operation completes
 
 - 
asDocumentTreedefault DocumentTree<V> asDocumentTree() Returns a newDocumentTreethat is backed by this instance.- Returns:
- new DocumentTreeinstance
 
 - 
asDocumentTreedefault DocumentTree<V> asDocumentTree(long timeoutMillis) Returns a newDocumentTreethat is backed by this instance.- Parameters:
- timeoutMillis- timeout duration for the returned DocumentTree operations
- Returns:
- new DocumentTreeinstance
 
 
- 
 
-