State Stores¶
Abstract interface and implementations for persisting entity state.
StateStoreClient
¶
Base class for persistent state store implementations.
Provides connect/disconnect lifecycle, context manager support, and
connection guards. Mirrors pycharter's MetadataStoreClient.
Subclasses must override connect() and should call
_require_connection() at the top of every method that touches the
backend.
Source code in src/pystator/stores/base.py
connect
¶
InMemoryStateStore
¶
In-memory state store for testing and simple use cases.
Implements sync, async, versioned, batch, and queryable protocols. Not suitable for production.
Source code in src/pystator/stores/base.py
get_states_batch
¶
set_states_batch
¶
Set multiple entity states at once.
Source code in src/pystator/stores/base.py
list_entities
¶
List entity IDs, optionally filtered by state.
Source code in src/pystator/stores/base.py
count_by_state
¶
Other backends (SQLiteStateStore, PostgresStateStore, MongoDBStateStore, RedisStateStore) are available from pystator.stores when the corresponding optional dependencies are installed. See the package structure and state stores guide.