saealib.core.StateStore#
- class saealib.core.StateStore(initial=None, *, generation=0)[source]#
Bases:
objectOwn versioned state values and consume each instance after a move.
- Parameters:
initial (Mapping[StateKey, object] | None)
generation (int)
Methods
Apply |
|
Return whether |
|
Return the value for |
|
Create a read-only view limited to the supplied declared keys. |
Method Details
- StateStore.__init__(initial=None, *, generation=0)[source]#
- Parameters:
initial (Mapping[StateKey, object] | None)
generation (int)
- Return type:
None
- StateStore.apply_patch(patch)[source]#
Apply
patchand return the new store, consuming this store.All update kinds, targets, and
PopulationRowUpdateoperations are validated against shadow populations before any owned value is changed. If preflight fails, this store remains live and its values are unchanged. After successful preflight, the operations are committed in write order and this store is consumed.- Parameters:
patch (StatePatch)
- Return type:
- StateStore.contains(key)[source]#
Return whether
keyis present in this store.- Parameters:
key (StateKey)
- Return type:
bool
- StateStore.get(key)[source]#
Return the value for
keyor raiseKeyErrorif absent.- Parameters:
key (StateKey[ValueT])
- Return type:
ValueT
- StateStore.view(reads, *, context=None, dispatch=None)[source]#
Create a read-only view limited to the supplied declared keys.
- Parameters:
reads (Iterable[StateKey] | StateContract)
context (object | None)
dispatch (Callable[[object], None] | None)
- Return type: