Documentation
¶
Overview ¶
Package loader rebuilds execution states: snapshot + tail of the log, the flow definition the execution is bound to, and archived executions.
Index ¶
- Variables
- func SegmentObject(execID string, first int) string
- type ArchivedEvent
- type Loader
- func (l *Loader) ArchiveObject(ctx context.Context, name string) ([]event.Event, error)
- func (l *Loader) Archived(ctx context.Context, execID string) ([]event.Event, error)
- func (l *Loader) DefOf(ctx context.Context, first event.Event) (*flow.Flow, error)
- func (l *Loader) History(ctx context.Context, execID string) ([]event.Event, error)
- func (l *Loader) IsArchived(ctx context.Context, execID string) (bool, error)
- func (l *Loader) Load(ctx context.Context, execID string, upTo uint64) (*fold.State, *flow.Flow, error)
- func (l *Loader) LoadArchived(ctx context.Context, execID string, upTo uint64) (*fold.State, *flow.Flow, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotArchived = errors.New("loader: execution is not archived")
ErrNotArchived is returned when an execution has no archive.
Functions ¶
func SegmentObject ¶
SegmentObject names the archive object of the history segment of execID starting at event index first. Execution ids contain no dots, so it cannot collide with an execution's own archive object.
Types ¶
type ArchivedEvent ¶
type ArchivedEvent struct {
Seq uint64 `json:"seq"`
DecisionEnd bool `json:"decision_end"`
Event json.RawMessage `json:"event"`
}
ArchivedEvent is one event in an archive object.
type Loader ¶
type Loader struct {
In *infra.Infra
Log *eventlog.Log
Snaps *snapshot.Store
Flows *registry.Registry
}
Loader rebuilds states.
func New ¶
func New(in *infra.Infra, log *eventlog.Log, snaps *snapshot.Store, flows *registry.Registry) *Loader
New returns a Loader.
func (*Loader) ArchiveObject ¶
ArchiveObject reads one object of the archive store as events.
func (*Loader) Archived ¶
Archived returns the archived events of execID (the live log it had when it was archived; segments are separate, see History).
func (*Loader) History ¶
History returns every event of execID, oldest first: the archived history segments (continue-as-new) followed by the live log, or by the archive object of an archived execution. ErrNotArchived means it does not exist.
func (*Loader) IsArchived ¶
IsArchived reports whether an archive object exists for execID.
func (*Loader) Load ¶
func (l *Loader) Load(ctx context.Context, execID string, upTo uint64) (*fold.State, *flow.Flow, error)
Load returns the state of execID folded up to stream sequence upTo (0 = everything) and its flow definition. A missing execution yields an empty state (Exists() == false) and a nil definition.