Introduce InMemoryDataTreeModification.AppliedToSnapshot 27/114927/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 9 Jan 2025 02:56:52 +0000 (03:56 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 16 Jan 2025 10:39:28 +0000 (11:39 +0100)
commit89de043f490366122007a677905dcd409744f8d6
treeab5824854935478312698c8d44bd3a9e84c7bff6
parent4822d02a3ffb647358b440e97b35d4a37b8638b9
Introduce InMemoryDataTreeModification.AppliedToSnapshot

Once we complete ready(), the user side of DataTreeModification is free
to invoke applyToCursor() and newModification() methods.

Introduce AppliedToSnapshot, which we enter into when we first observe
Ready state in newModification(). Any subsequent calls to
newModification() will just pick up snapshot root from AppliedToSnapshot
without touching ModifiedNode -- and thus we do not need any further
locking.

For the applyToCursor() path we may be racing with validate()/prepare(),
so perform that operation with the exclusive lock.

This brings more clarity as to what ModifiedNode.children is now and how
it should behave in the future -- which we thoroughly outline in FIXMEs.

JIRA: YANGTOOLS-1651
Change-Id: Icfb55beba97d9432e444df87631a03975bebb8e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b7935ec11fcc89d14c8e78db52e2bbba85ee0f23)
data/yang-data-tree-ri/src/main/java/org/opendaylight/yangtools/yang/data/tree/impl/InMemoryDataTreeModification.java
data/yang-data-tree-ri/src/test/java/org/opendaylight/yangtools/yang/data/tree/impl/InMemoryDataTreeModificationTest.java