SessionStateStore
Last-write-wins per family, in arrival order.
Class in muse_code
Cursors are opaque strings and MUST NOT be parsed or ordered,
so ordering here is by arrival: the server emits view events in cursor
order on every connection, and a page’s events are ascending. The one
cursor use is EXACT-EQUALITY replay de-duplication, and it remembers only
the family’s LATEST cursor — it refuses only a back-to-back replay of the
family’s most recent event. The splice caller must skip
already-applied page events itself, which it does by construction: the
splice pages forward from after and discards paged events at cursors
=
nextas duplicates of the live buffer. No relational comparison exists: string order diverges from cursor order at every digit rollover (“v:s:10” < “v:s:9” as strings), which would drop genuinely newer events.
Constructor
Section titled “Constructor”SessionStateStore()
Methods
Section titled “Methods”| Method | Signature | Description |
|---|---|---|
apply |
apply(family: str, value: StateValue, cursor: str | None = None) -> StateApplyOutcome |
Apply a state event. |
get |
get(family: str) -> StateValue |
Read a family: the held value, or None when absent or cleared. |
has |
has(family: str) -> bool |
Whether the family holds any fact (an explicit clear counts). |
families |
families() -> list[str] |
Every family that holds a value, in insertion order. |
seed |
seed(entries: Iterable[tuple[str, StateValue]], cursor: str | None = None) -> None |
Seed from a snapshot’s state block: authoritative, replaces wholesale. |
Source
clients/sdk-py/src/muse_code/fold/state_store.py:51