saealib.core.StateStore#

class saealib.core.StateStore(initial=None, *, generation=0)[ソース]#

ベースクラス: object

Own versioned state values and consume each instance after a move.

パラメータ:
  • initial (Mapping[StateKey, object] | None)

  • generation (int)

Methods

__init__

apply_patch

Apply patch and return the new store, consuming this store.

contains

Return whether key is present in this store.

get

Return the value for key or raise KeyError if absent.

view

Create a read-only view limited to the supplied declared keys.

Method Details

StateStore.__init__(initial=None, *, generation=0)[ソース]#
パラメータ:
  • initial (Mapping[StateKey, object] | None)

  • generation (int)

戻り値の型:

None

StateStore.apply_patch(patch)[ソース]#

Apply patch and return the new store, consuming this store.

All update kinds, targets, and PopulationRowUpdate operations 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.

パラメータ:

patch (StatePatch)

戻り値の型:

StateStore

StateStore.contains(key)[ソース]#

Return whether key is present in this store.

パラメータ:

key (StateKey)

戻り値の型:

bool

StateStore.get(key)[ソース]#

Return the value for key or raise KeyError if absent.

パラメータ:

key (StateKey[ValueT])

戻り値の型:

ValueT

StateStore.view(reads, *, context=None, dispatch=None)[ソース]#

Create a read-only view limited to the supplied declared keys.

パラメータ:
  • reads (Iterable[StateKey] | StateContract)

  • context (object | None)

  • dispatch (Callable[[object], None] | None)

戻り値の型:

StateView