castlecraft_engineer.abstractions.projection_store
¶
castlecraft_engineer.abstractions.projection_store
¶
ProjectionStore
¶
Bases: ABC
, Generic[TEventId]
Abstract base class for a store that manages the state of projections. This is crucial for projectors to know where they left off in an event stream.
Source code in src/castlecraft_engineer/abstractions/projection_store.py
clear_projection_state(projection_id)
abstractmethod
async
¶
Optional: Clears the state for a given projection. Useful for replaying a projection from the beginning.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
projection_id
|
ProjectionId
|
The ID of the projection whose state is to be cleared. |
required |
Source code in src/castlecraft_engineer/abstractions/projection_store.py
get_projection_state(projection_id)
abstractmethod
async
¶
Retrieves the current state of a given projection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
projection_id
|
ProjectionId
|
The unique identifier of the projection. |
required |
Returns:
Type | Description |
---|---|
Optional[ProjectionState]
|
The ProjectionState object, or None if no state exists for the projection. |
Source code in src/castlecraft_engineer/abstractions/projection_store.py
save_projection_state(projection_state)
abstractmethod
async
¶
Saves or updates the state of a projection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
projection_state
|
ProjectionState
|
The ProjectionState object to persist. |
required |