Introduce InMemoryDataTreeModification.AppliedToSnapshot 69/114869/34
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 9 Jan 2025 02:56:52 +0000 (03:56 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 15 Jan 2025 18:11:04 +0000 (19:11 +0100)
commitb7935ec11fcc89d14c8e78db52e2bbba85ee0f23
tree8411ac1f6d56e124e0d17fd22958dc5c6f0da17b
parent7ca8e1247a7fe52adef2febb71187791fb27782e
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>
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