Documentation
¶
Overview ¶
Package projection provides engine components that orchestrate the execution of projection message handlers.
Index ¶
- func InitializeHandler(ctx context.Context, db *sql.DB, handlerConfig *config.Projection) error
- type Compactor
- type EventPump
- func (p *EventPump) AcquireDelivery(ctx context.Context, tx *sql.Tx) (messagepump.Delivery, bool, error)
- func (p *EventPump) HandleDelivery(ctx context.Context, tx *sql.Tx, delivery messagepump.Delivery, ...) error
- func (p *EventPump) PostponeDelivery(ctx context.Context, tx *sql.Tx, delivery messagepump.Delivery, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeHandler ¶
InitializeHandler initializes the state of a projection message handler.
It is called by the engine on startup, before any components are started.
Types ¶
type Compactor ¶
type Compactor struct {
DB *sql.DB
Handler dogma.ProjectionMessageHandler
Identity *identitypb.Identity
Interval time.Duration
Logger *slog.Logger
}
Compactor is an engine component that periodically attempts to compact a projection by invoking dogma.ProjectionMessageHandler.Compact().
type EventPump ¶
type EventPump struct {
DB *sql.DB
Handler dogma.ProjectionMessageHandler
Identity *identitypb.Identity
Concurrency dogma.ConcurrencyPreference
EventTypeIDs *uuidpb.Set
Logger *slog.Logger
}
EventPump is a messagepump.Driver that delivers pending events to a projection message handler.
func (*EventPump) AcquireDelivery ¶
func (p *EventPump) AcquireDelivery( ctx context.Context, tx *sql.Tx, ) (messagepump.Delivery, bool, error)
AcquireDelivery attempts to acquire the next pending event for the handler on one of its tracked event streams.
If there are no relevant events available on the chosen stream, it advances the checkpoint offset to the end of the stream so that the stream is not re-acquired until new events arrive.
func (*EventPump) HandleDelivery ¶
func (p *EventPump) HandleDelivery( ctx context.Context, tx *sql.Tx, delivery messagepump.Delivery, envelope *envelopepb.Envelope, logger *slog.Logger, ) error
HandleDelivery dispatches an event to the projection handler.