BUG-7464: Split TrieMap into read-only and read-write 51/49951/12
authorRobert Varga <rovarga@cisco.com>
Mon, 2 Jan 2017 22:25:14 +0000 (23:25 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 10 Jan 2017 19:12:11 +0000 (20:12 +0100)
commitf8f8071625fd610f203aec17232048e8cc96b84d
tree3be175af5efa611cd396db4a5b25620635eb909e
parent365457035d8505d813902096e4ca0b226760cc29
BUG-7464: Split TrieMap into read-only and read-write

Having inter-twined mutable and immutable implementations is
a maintenance and performance drag, because mutable version
is checking for read-only on each mutation and also everytime
it needs to CAS_ROOT. On the other hand, the immutable
implementation does not need to care about RDCSS, as it never
updates its root -- and can in fact have it non-volatile.

Split the implementation into three classes, with TrieMap
definining the API contract and holding common bits, MutableTrieMap
encapsulating RDCSS and mutation bits and ImmutableTrieMap
having simple guards against mutation.

Change-Id: Icae923d6312901b37252af80b03b0a0912cacaec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
22 files changed:
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/ImmutableTrieMap.java [new file with mode: 0644]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableTrieMap.java [new file with mode: 0644]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/SerializationProxy.java [moved from third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/ExternalForm.java with 74% similarity]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMap.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/SnapshotTest.java [new file with mode: 0644]
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestCNodeFlagCollision.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestCNodeInsertionIncorrectOrder.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestConcurrentMapPutIfAbsent.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestConcurrentMapRemove.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestConcurrentMapReplace.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestDelete.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestHashCollisions.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestHashCollisionsRemove.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestHashCollisionsRemoveIterator.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestInsert.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestInstantiationSpeed.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMapIterator.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMultiThreadAddDelete.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMultiThreadInserts.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMultiThreadMapIterator.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestReadOnlyAndUpdatableIterators.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestSerialization.java