Sourcing::Plugin
Abstract role defining the interface for event storage backends. All plugins must implement these methods.
Abstract Methods
method emit($event, :$current-version)
Emits an event to the storage backend. Implementations should handle persistence and broadcast on the event supply.
method get-events(%ids, %map)
Retrieves all events matching the given identity criteria and event type map.
method get-events-after($id, %ids, %map)
Retrieves events that occurred after the specified version ID.
method supply
Returns a Supply of events from this storage backend.
method store-cached-data(Mu:U, %)
Stores the current state and version of a projection.
method get-cached-data(Mu:U, %) is rw
Retrieves the cached state and version for a projection. Returns a Hash with last-id and data keys.
Class Methods
method use(|c)
Activates this plugin as the current sourcing configuration by setting PROCESS::<$SourcingConfig>.
Sourcing::Plugin::Memory.use;
Dynamic Variables
| Variable | Description |
|---|---|
$*SourcingConfig | The active plugin instance, set by Plugin.use |
$*SourcingReplay | When truthy, suppresses event emission from auto-generated methods. Set to True when replaying events to prevent double-emission. |
Implementing a Plugin
See the Writing a Plugin Guide for a step-by-step tutorial.
See Also
- Sourcing::Plugin::Memory — the built-in in-memory implementation
- Writing a Plugin Guide — how to implement your own plugin