Class InMemoryAnnotationLayer

Namespace
Kuestenlogik.Bowire.Semantics
Assembly
Kuestenlogik.Bowire.dll

Fast hash-keyed in-memory annotation layer — the session-scope storage for manual edits that have not been persisted to disk yet.

public sealed class InMemoryAnnotationLayer
Inheritance
InMemoryAnnotationLayer
Inherited Members

Remarks

Acts as a single layer in the LayeredAnnotationStore composition: the store decides which source-priority the layer represents, the layer itself just carries entries keyed by AnnotationKey. The default LayeredAnnotationStore wiring uses an InMemoryAnnotationLayer at User priority for "manual session edits that survive only until tab close."

Backed by ConcurrentDictionary<TKey, TValue> for thread-safe reads + writes; concurrent UI mutation and SSE-driven reads can interleave without locking.

Constructors

InMemoryAnnotationLayer()

public InMemoryAnnotationLayer()

Properties

Count

Number of entries currently held by the layer.

public int Count { get; }

Property Value

int

Methods

Clear()

Clear every entry from the layer.

public void Clear()

Get(AnnotationKey)

Get the raw tag at key without applying any resolution priority — single-layer lookup.

public SemanticTag? Get(AnnotationKey key)

Parameters

key AnnotationKey

Returns

SemanticTag

Remove(AnnotationKey)

Remove the entry at key. Returns true when an entry was actually removed.

public bool Remove(AnnotationKey key)

Parameters

key AnnotationKey

Returns

bool

Set(AnnotationKey, SemanticTag)

Insert or replace the tag at key. Returns the layer for chaining.

public InMemoryAnnotationLayer Set(AnnotationKey key, SemanticTag tag)

Parameters

key AnnotationKey
tag SemanticTag

Returns

InMemoryAnnotationLayer

Snapshot()

Snapshot of every (key, tag) pair currently held. The returned sequence is detached from the live dictionary, so concurrent mutation does not throw mid-enumeration.

public IReadOnlyCollection<KeyValuePair<AnnotationKey, SemanticTag>> Snapshot()

Returns

IReadOnlyCollection<KeyValuePair<AnnotationKey, SemanticTag>>