Table of Contents

Namespace Vintagestory.Common

Classes

ConcurrentSmallDictionary<TKey, TValue>

Use like any IDictionary. Similar to a FastSmallDictionary, but this one is thread-safe for simultaneous reads and writes - will not throw a ConcurrentModificationException
This also inherently behaves as an OrderedDictionary (though without the OrderedDictionary extension methods such as ValuesOrdered, those can be added in future if required)
Low-lock: there is no lock or interlocked operation except when adding new keys or when removing entries
Low-memory: and contains only a single null field, if it is empty
Two simultaneous writes, with the same key, at the same time, on different threads: small chance of throwing an intentional ConcurrentModificationException if both have the same keys, otherwise it's virtually impossible for us to preserve the rule that the Dictionary holds exactly one entry per key

DTable<TKey, TValue>

A single object to allow the arrays in ConcurrentSmallDictionary to be replaced atomically. Keys, once entered in the keys array within a DTable, are invariable: if we ever need to remove a key we will create a new DTable