Documentation
¶
Overview ¶
Package projection maintains the visibility index: a KV projection of every execution's summary plus membership keys by status, flow and declared search attribute, so List/Query never scan the event stream. It is rebuildable from scratch by replaying the events (reset the dispatcher consumers).
Keys:
x.<exec> summary JSON s.<status>.<exec> status membership f.<flow>.<exec> flow membership a.<attr>.<hash>.<exec> search attribute membership (hash of the value)
Index ¶
- Variables
- func AttrHash(v string) string
- func Index(ctx context.Context, in *infra.Infra, st *fold.State, ...) error
- func IndexFrom(ctx context.Context, in *infra.Infra, st *fold.State, created bool, ...) error
- func IsQuarantined(ctx context.Context, in *infra.Infra, execID string) (bool, error)
- func MarkArchived(ctx context.Context, in *infra.Infra, execID string) error
- func Quarantine(ctx context.Context, in *infra.Infra, execID string, seq uint64, reason string) error
- func Quarantined(ctx context.Context, in *infra.Infra) ([]string, error)
- func SetTerminal(ctx context.Context, in *infra.Infra, execID string, status fold.Status, ...) error
- func Unquarantine(ctx context.Context, in *infra.Infra, execID string) error
- type Filter
- type QuarantineMark
- type Summary
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFilter = errors.New("projection: invalid filter")
ErrInvalidFilter is returned for a filter value that is not a valid token: it would otherwise become a wildcard in the KV key filter.
Functions ¶
func Index ¶
Index writes the summary of st. created says the execution is new (flow and attribute memberships are written once); statusChanged says the status membership must move.
func IndexFrom ¶
func IndexFrom(ctx context.Context, in *infra.Infra, st *fold.State, created bool, prev fold.Status) error
IndexFrom is Index for a caller that knows the status before the change (the dispatcher folds it): a new execution gets its status key, a change moves the key from prev, and no other status key is touched. On a cluster every key write is a replicated round trip, so this saves four per change.
func IsQuarantined ¶
IsQuarantined reports whether execID is quarantined.
func MarkArchived ¶
MarkArchived flags the summary of an execution as archived.
func Quarantine ¶
func Quarantine(ctx context.Context, in *infra.Infra, execID string, seq uint64, reason string) error
Quarantine records that the dispatcher gave up on execID's events from sequence seq: membership key q.<exec> (checked by every dispatcher) and the summary flag.
func Quarantined ¶
Quarantined lists the quarantined executions.
Types ¶
type Filter ¶
type Filter struct {
Status fold.Status
Flow string
// Attr / Value select by search attribute.
Attr string
Value string
Limit int
}
Filter selects executions. Empty fields match everything.
type QuarantineMark ¶
QuarantineMark is the value of q.<exec>: the first event the dispatcher could not process.
type Summary ¶
type Summary struct {
ExecID string `json:"exec_id"`
Flow string `json:"flow"`
FlowHash string `json:"flow_hash"`
Status fold.Status `json:"status"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Attrs map[string]string `json:"attrs,omitempty"`
Parent *event.ParentRef `json:"parent,omitempty"`
ForkedFrom string `json:"forked_from,omitempty"`
Error string `json:"error,omitempty"`
Reason string `json:"reason,omitempty"`
LastSeq uint64 `json:"last_seq"`
Archived bool `json:"archived,omitempty"`
// Quarantined is set when the dispatcher gave up on this execution's
// events (see Quarantine); QuarantineReason says why.
Quarantined bool `json:"quarantined,omitempty"`
QuarantineReason string `json:"quarantine_reason,omitempty"`
}
Summary is the indexed view of an execution.