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)