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.yangtools.yang.data.api.schema.tree.spi;
10 import org.opendaylight.yangtools.concepts.Identifiable;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
16 * A very basic data tree node. It has a version (when it was last modified), a subtree version (when any of its
17 * children were modified) and some read-only data.
19 * Semantic difference between these two is important when dealing with modifications involving parent/child
20 * relationships and what operations can be execute concurrently without creating a data dependency conflict.
22 * A replace/delete operation cannot be applied to this node if the subtree version does not match. This mismatch
23 * still allows modifications to its descendants.
25 * A mismatch in node version indicates a replacement, preventing a modification of descendants or itself.
27 // FIXME: BUG-2399: clarify that versioning rules are not enforced for non-presence containers, as they are not
28 // considered to be data nodes.
29 public interface TreeNode extends Identifiable<PathArgument>, StoreTreeNode<TreeNode> {
31 * Get the data node version. This version is updated whenever the data representation of this particular node
32 * changes as a result of a direct write to this node or to its parent nodes -- thus indicating that this node
33 * was logically replaced.
35 * @return Current data node version.
40 * Get the subtree version. This version is updated whenever the data representation of this particular node
41 * changes as the result of a direct or indirect child node being created, replaced or removed.
43 * @return Current subtree version.
45 Version getSubtreeVersion();
48 * Get a read-only view of the underlying data.
50 * @return Unmodifiable view of the underlying data.
52 NormalizedNode<?, ?> getData();
55 * Get a mutable, isolated copy of the node.
57 * @return Mutable copy
59 MutableTreeNode mutable();