// This is called only from inside persistenceStore.Write public void Add(RavenJToken key) { IComparable actualKey = transform(key); Index = Index.AddOrUpdate(actualKey, new EmptyAVLTree <RavenJToken, RavenJToken>(RavenJTokenComparer.Instance, RavenJTokenCloner.Clone, RavenJTokenCloner.Clone).Add(key, key), (comparable, tree) => tree.Add(key, key)); }
// This is called only from inside persistenceStore.Write public void Remove(RavenJToken key) { IComparable actualKey = transform(key); var result = Index.Search(actualKey); if (result.IsEmpty) { return; } bool removed; RavenJToken _; var removedResult = result.Value.TryRemove(key, out removed, out _); if (removedResult.IsEmpty) { IBinarySearchTree <RavenJToken, RavenJToken> ignored; Index = Index.TryRemove(actualKey, out removed, out ignored); } else { Index = Index.AddOrUpdate(actualKey, removedResult, (comparable, tree) => removedResult); } }