Class RedbTsakStateStore

Assembly: redb.Tsak.Core.dll

Redb-backed state store. Persists key-value state across restarts.
The key lives in ValueUnique: uniqueness per key is enforced by the database and
SaveByUniqueAsync makes a true upsert — two nodes setting
the same key concurrently converge on one record instead of duplicating it.
The stored key is "{cluster}:{key}" (): several clusters
on one database keep their own route and context state. An entry written before cluster
isolation (unprefixed, no ) is still read — by key and
by prefix — until this cluster writes the key; removing a key removes that old entry too, so
the old value never comes back. Keys come back from in caller form.
Keys are normalized with (440-cap of the key column;
caller keys embed context/route ids and carry no length contract — review 2026-09-02, В8).
value_string still mirrors the raw key (truncated to its own cap) for visibility.
Prefix search is server-side and case-sensitive ordinal (owner decision 2026-09-02); the
contract note lives on .
Every operation awaits a one-time ensure step (scheme sync + legacy-key backfill), so a
host without TsakHostedService — or a read racing its startup — still sees pre-V4 rows
(review 2026-09-02, В4).

public class RedbTsakStateStore : ITsakStateStore

Inheritance

Object→RedbTsakStateStore

Implements

Methods

GetAsync(string)

public Task<string?> GetAsync(string key)

GetByPrefixAsync(string)

public Task<IReadOnlyDictionary<string, string>> GetByPrefixAsync(string prefix)

RemoveAsync(string)

public Task RemoveAsync(string key)

SetAsync(string, string)

public Task SetAsync(string key, string value)

Constructors