Split out yang-data-tree-{api,spi}
[yangtools.git] / data / yang-data-tree-api / src / main / java / org / opendaylight / yangtools / yang / data / tree / api / ModificationType.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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 package org.opendaylight.yangtools.yang.data.tree.api;
9
10 /**
11  * Enumeration of all possible node modification states. These are used in data tree modification context to quickly
12  * assess what sort of modification the node is undergoing.
13  */
14 public enum ModificationType {
15     /**
16      * Node is currently unmodified.
17      */
18     UNMODIFIED,
19
20     /**
21      * A child node, either direct or indirect, has been modified. This means
22      * that the data representation of this node has potentially changed.
23      */
24     SUBTREE_MODIFIED,
25
26     /**
27      * This node has been placed into the tree, potentially completely replacing
28      * pre-existing contents.
29      */
30     WRITE,
31
32     /**
33      * This node has been deleted along with any of its child nodes.
34      */
35     DELETE,
36
37     /**
38      * This node has appeared because it is implied by one of its children. This type is usually produced when a
39      * structural container is created to host some leaf entries. It does not have an associated before-image.
40      *
41      * <p>
42      * Its semantics is a combination of SUBTREE_MODIFIED and WRITE, depending on which context it is being interpreted.
43      *
44      * <p>
45      * Users who track the value of the node can treat it as a WRITE. Users transforming a {@link DataTreeCandidate} to
46      * operations on a {@link DataTreeModification} should interpret it as a SUBTREE_MODIFIED and examine its children.
47      * This is needed to correctly deal with concurrent operations on the nodes children, as issuing a write on the
48      * DataTreeModification could end up removing any leaves which have not been present at the DataTree which emitted
49      * this event.
50      */
51     APPEARED,
52
53     /**
54      * This node has disappeared because it is no longer implied by any children. This type is usually produced when a
55      * structural container is removed because it has become empty. It does not have an associated after-image.
56      *
57      * <p>
58      * Its semantics is a combination of SUBTREE_MODIFIED and DELETE, depending on which context it is being
59      * interpreted. Users who track the value of the node can treat it as a DELETE, as the container has disappeared.
60      * Users transforming a {@link DataTreeCandidate} to operations on a {@link DataTreeModification} should interpret
61      * it as a SUBTREE_MODIFIED and examine its children.
62      *
63      * <p>
64      * This is needed to correctly deal with concurrent operations on the nodes children, as issuing a delete on the
65      * DataTreeModification would end up removing any leaves which have not been present at the DataTree which emitted
66      * this event.
67      */
68     DISAPPEARED,
69 }