Documentation
¶
Overview ¶
Package saga drives the sagas (invariant I5): it looks at the open sagas again and again and does what each one needs next.
Input: the sagas in the database (created by erp.create_sales_order and wms.reserve) and the facts about their steps. Output: changes to the sagas, written by store.AdvanceSaga, and the 856, which this package asks for when the shipment is done and the warehouse has given its facts. The decisions themselves are in internal/store (decide); here are the loop, the two outside questions (what the warehouse recorded, whether an effect exists), and the time limits.
The runner keeps no state of its own. Any number of processes may run it: a saga that another one is working on is skipped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Facts ¶
type Facts interface {
Shipment(ctx context.Context, externalID string) (adapters.Shipment, error)
}
Facts gives the facts the warehouse recorded about a shipment.
type Runner ¶
type Runner struct {
Store *store.Store
Adapter adapters.Adapter // asked whether an effect exists, for a step that failed without an answer
Facts Facts
Policy tools.Decider // decides the 856 (it is a tool call of the saga itself)
Scale float64 // the time limits are divided by it (EDIGATE_TIME_SCALE); 0 means 1
Log *slog.Logger
// AckTimeout is how long a sent document waits for its 997. Zero means 24 hours divided
// by Scale, but not less than 60 seconds.
AckTimeout time.Duration
// Poll is the pause between two passes; zero means half a second.
Poll time.Duration
}
Runner advances the sagas.