Interface IScyllaMap<TKey, TValue>
Common contract for key/value map collections (dictionary-like associative containers). Provides a minimal, allocation-free "try"-based surface for insertion, retrieval, and removal so that different map implementations - such as the managed open-addressing ScyllaMap<TKey, TValue> and the DOTS-native ScyllaMapDOTS<TKey, TValue> - can be used interchangeably through this interface.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public interface IScyllaMap<TKey, TValue> : IScyllaCollection
Type Parameters
| Name | Description |
|---|---|
| TKey | The type of keys stored in the map. Reference-type keys must not be |
| TValue | The type of values associated with each key. |
Remarks
All mutating operations use a "try"-pattern that returns a bool indicating success or
failure rather than throwing for expected cases such as duplicate-key or capacity-full conditions.
Only truly exceptional states (e.g. a null key) cause exceptions.
Thread safety is not guaranteed by this interface. Consult the ThreadSafety property
of the concrete implementation, or use an explicit synchronized wrapper such as
ScyllaMap<TKey, TValue>.SynchronizedScyllaMap.
Typical use cases include type-keyed registries, rule tables, dependency graphs, spatial
indices, and any scenario that requires fast O(1) average-case key lookup without the overhead
of Dictionary<TKey, TValue> allocation patterns.
Methods
ContainsKey(TKey)
Determines whether the map contains the specified key.
Declaration
bool ContainsKey(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to locate. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|
TryAdd(TKey, TValue)
Attempts to insert a new key/value pair into the map. This operation does not overwrite an existing entry; use a separate set/update operation if upsert behaviour is required.
Declaration
bool TryAdd(TKey key, TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to insert. Must not be |
| TValue | value | The value to associate with |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetValue(TKey, out TValue)
Attempts to retrieve the value associated with the specified key.
Declaration
bool TryGetValue(TKey key, out TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to look up. Must not be |
| TValue | value | When this method returns |
Returns
| Type | Description |
|---|---|
| bool |
|
TryRemove(TKey)
Attempts to remove the entry associated with the specified key. For open-addressing implementations such as ScyllaMap<TKey, TValue>, removal places a tombstone in the slot to preserve probe-chain integrity; the slot is reclaimed during a subsequent rehash or compaction.
Declaration
bool TryRemove(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to remove. Must not be |
Returns
| Type | Description |
|---|---|
| bool |
|