surpressed all style warnings from the LSP server.

This commit is contained in:
Linus Björnstam 2026-05-21 13:13:22 +02:00
parent 7ee2238248
commit 23c4ac299e
13 changed files with 346 additions and 371 deletions

View file

@ -1,35 +1,34 @@
using System.Collections;
namespace PersistentOrderedMap;
public sealed class TransientOrderedMap<K, V, TStrategy> : BaseOrderedMap<K, V, TStrategy> where TStrategy : IKeyStrategy<K>
public sealed class TransientOrderedMap<TK, TV, TStrategy> : BaseOrderedMap<TK, TV, TStrategy> where TStrategy : IKeyStrategy<TK>
{
// This is mutable, but we treat it as readonly for the ID generation logic usually.
private OwnerId _transactionId;
public TransientOrderedMap(Node<K> root, TStrategy strategy, int count)
public TransientOrderedMap(Node<TK> root, TStrategy strategy, int count)
: base(root, strategy, count)
{
_transactionId = OwnerId.Next();
}
public void Set(K key, V value)
public void Set(TK key, TV value)
{
_root = BTreeFunctions.Set(_root, key, value, _strategy, _transactionId, out bool countChanged);
Root = BTreeFunctions.Set(Root, key, value, Strategy, _transactionId, out bool countChanged);
if (countChanged) Count++;
}
public void Remove(K key)
public void Remove(TK key)
{
_root = BTreeFunctions.Remove<K,V, TStrategy>(_root, key, _strategy, _transactionId, out bool removed);
Root = BTreeFunctions.Remove<TK,TV, TStrategy>(Root, key, Strategy, _transactionId, out bool removed);
if (removed) Count--;
}
public PersistentOrderedMap<K, V, TStrategy> ToPersistent()
public PersistentOrderedMap<TK, TV, TStrategy> ToPersistent()
{
// 1. Create the snapshot by copying all relevant information
var snapshot = new PersistentOrderedMap<K, V, TStrategy>(_root, _strategy, Count);
var snapshot = new PersistentOrderedMap<TK, TV, TStrategy>(Root, Strategy, Count);
// 2. Protect the snapshot from THIS TransientOrderedMap by getting a new ownerId
// so that future edits will be done by CoW