Documentation
¶
Overview ¶
Package postgres persists event rules, durable events, and executions in PostgreSQL.
Index ¶
- type Store
- func (s *Store) Bind(ctx context.Context, binding eventrule.Binding) error
- func (s *Store) ClaimPendingExecutions(ctx context.Context, request eventrule.ExecutionClaimRequest) (eventrule.ExecutionClaimBatch, error)
- func (s *Store) ClaimRetryExecutions(ctx context.Context, request eventrule.ExecutionClaimRequest) (eventrule.ExecutionClaimBatch, error)
- func (s *Store) CommitEventPlan(ctx context.Context, definition eventrule.Event, ...) (*eventrule.Event, error)
- func (s *Store) Create(ctx context.Context, rule *eventrule.Rule) (*eventrule.Rule, error)
- func (s *Store) Delete(ctx context.Context, id uuid.UUID) error
- func (s *Store) Events(ctx context.Context) ([]eventrule.Event, error)
- func (s *Store) Executions(ctx context.Context) ([]eventrule.Execution, error)
- func (s *Store) GetByID(ctx context.Context, id uuid.UUID) (*eventrule.Rule, error)
- func (s *Store) GetForScope(ctx context.Context, eventType eventrule.Type, scope eventrule.Scope) (*eventrule.Binding, error)
- func (s *Store) List(ctx context.Context, request eventrule.RuleListRequest) (eventrule.RuleListPage, error)
- func (s *Store) ObserveEvent(ctx context.Context, key eventrule.EventKey) (*eventrule.Event, error)
- func (s *Store) ReplaceActions(ctx context.Context, id uuid.UUID, actions []eventrule.Action) error
- func (s *Store) SetEnabled(ctx context.Context, id uuid.UUID, enabled bool) error
- func (s *Store) TransitionClaimedExecution(ctx context.Context, id uuid.UUID, token uuid.UUID, ...) error
- func (s *Store) Unbind(ctx context.Context, eventType eventrule.Type, scope eventrule.Scope) error
- func (s *Store) UpdateMetadata(ctx context.Context, id uuid.UUID, metadata eventrule.RuleMetadata) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the PostgreSQL event-rule persistence boundary shared by the processor, scheduler, and executors.
func (*Store) Bind ¶
Bind stores a rule-to-scope association. Locking the parent rule serializes the site-versus-rack check for concurrent bindings of the same rule; partial unique indexes serialize conflicts for the same resolved scope.
func (*Store) ClaimPendingExecutions ¶
func (s *Store) ClaimPendingExecutions( ctx context.Context, request eventrule.ExecutionClaimRequest, ) (eventrule.ExecutionClaimBatch, error)
ClaimPendingExecutions atomically allocates pending attempts.
func (*Store) ClaimRetryExecutions ¶
func (s *Store) ClaimRetryExecutions( ctx context.Context, request eventrule.ExecutionClaimRequest, ) (eventrule.ExecutionClaimBatch, error)
ClaimRetryExecutions atomically allocates due deferred or expired attempts.
func (*Store) CommitEventPlan ¶
func (s *Store) CommitEventPlan( ctx context.Context, definition eventrule.Event, planned []eventrule.PlannedExecution, ) (*eventrule.Event, error)
CommitEventPlan atomically inserts an event and all immutable action plans. A duplicate source event records another observation without changing or resuming its existing executions.
func (*Store) Events ¶
Events returns stable event snapshots for diagnostics and integration tests without recording another observation.
func (*Store) Executions ¶
Executions returns stable execution snapshots for diagnostics and integration tests.
func (*Store) GetForScope ¶
func (s *Store) GetForScope( ctx context.Context, eventType eventrule.Type, scope eventrule.Scope, ) (*eventrule.Binding, error)
GetForScope returns the binding for an event type and scope.
func (*Store) List ¶
func (s *Store) List( ctx context.Context, request eventrule.RuleListRequest, ) (eventrule.RuleListPage, error)
List returns persisted rules matching the filter in stable ID order.
func (*Store) ObserveEvent ¶
func (s *Store) ObserveEvent( ctx context.Context, key eventrule.EventKey, ) (*eventrule.Event, error)
ObserveEvent records and returns an existing source event. Missing events are represented by (nil, nil).
func (*Store) ReplaceActions ¶
func (s *Store) ReplaceActions( ctx context.Context, id uuid.UUID, actions []eventrule.Action, ) error
ReplaceActions replaces all actions belonging to one persisted rule.
func (*Store) SetEnabled ¶
SetEnabled changes one persisted rule's enabled state.
func (*Store) TransitionClaimedExecution ¶
func (s *Store) TransitionClaimedExecution( ctx context.Context, id uuid.UUID, token uuid.UUID, result eventrule.ExecutionResult, ) error
TransitionClaimedExecution persists an attempt result only while token owns the locked running execution. Expiration alone does not invalidate the token.
func (*Store) Unbind ¶
func (s *Store) Unbind( ctx context.Context, eventType eventrule.Type, scope eventrule.Scope, ) error
Unbind atomically deletes the binding for an event type and scope.
func (*Store) UpdateMetadata ¶
func (s *Store) UpdateMetadata( ctx context.Context, id uuid.UUID, metadata eventrule.RuleMetadata, ) error
UpdateMetadata updates one persisted rule's descriptive fields.