Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) JoinI(ctx context.Context, flow *workflow.Flow) (err error)
- func (svc *Mock) JoinO(ctx context.Context, flow *workflow.Flow) (done bool, err error)
- func (svc *Mock) MockJoinI(handler func(ctx context.Context, flow *workflow.Flow) (err error)) *Mock
- func (svc *Mock) MockJoinO(handler func(ctx context.Context, flow *workflow.Flow) (done bool, err error)) *Mock
- func (svc *Mock) MockNested(handler func(ctx context.Context, flow *workflow.Flow) (done bool, err error)) *Mock
- func (svc *Mock) MockTaskA(...) *Mock
- func (svc *Mock) MockTaskI(...) *Mock
- func (svc *Mock) MockTaskO(...) *Mock
- func (svc *Mock) Nested(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- func (svc *Mock) TaskA(ctx context.Context, flow *workflow.Flow) (outers []int, err error)
- func (svc *Mock) TaskI(ctx context.Context, flow *workflow.Flow, currentOuter int, innerItem int) (err error)
- func (svc *Mock) TaskO(ctx context.Context, flow *workflow.Flow, outerItem int) (inners []int, currentOuter int, err error)
- type Service
- func (svc *Service) Counters() (innerStarts, innerCompleted, joinIRuns, joinORuns int)
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) JoinI(ctx context.Context, flow *workflow.Flow) (err error)
- func (svc *Service) JoinO(ctx context.Context, flow *workflow.Flow) (done bool, err error)
- func (svc *Service) Nested(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) ReleaseSlowInners()
- func (svc *Service) TaskA(ctx context.Context, flow *workflow.Flow) (outers []int, err error)
- func (svc *Service) TaskI(ctx context.Context, flow *workflow.Flow, currentOuter int, innerItem int) (err error)
- func (svc *Service) TaskO(ctx context.Context, flow *workflow.Flow, outerItem int) (inners []int, currentOuter int, err error)
- type ToDo
Constants ¶
const ( Hostname = nestedfailfanoutflowapi.Hostname Version = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
Intermediate extends and customizes the generic base connector.
func NewIntermediate ¶
func NewIntermediate(impl ToDo) *Intermediate
NewIntermediate creates a new instance of the intermediate.
type Mock ¶
type Mock struct {
*Intermediate
// contains filtered or unexported fields
}
Mock is a mockable version of the microservice.
func (*Mock) MockJoinI ¶
func (svc *Mock) MockJoinI(handler func(ctx context.Context, flow *workflow.Flow) (err error)) *Mock
MockJoinI sets up a mock handler for JoinI.
func (*Mock) MockJoinO ¶
func (svc *Mock) MockJoinO(handler func(ctx context.Context, flow *workflow.Flow) (done bool, err error)) *Mock
MockJoinO sets up a mock handler for JoinO.
func (*Mock) MockNested ¶
func (svc *Mock) MockNested(handler func(ctx context.Context, flow *workflow.Flow) (done bool, err error)) *Mock
MockNested sets up a mock handler for the Nested workflow.
func (*Mock) MockTaskA ¶
func (svc *Mock) MockTaskA(handler func(ctx context.Context, flow *workflow.Flow) (outers []int, err error)) *Mock
MockTaskA sets up a mock handler for TaskA.
func (*Mock) MockTaskI ¶
func (svc *Mock) MockTaskI(handler func(ctx context.Context, flow *workflow.Flow, currentOuter int, innerItem int) (err error)) *Mock
MockTaskI sets up a mock handler for TaskI.
func (*Mock) MockTaskO ¶
func (svc *Mock) MockTaskO(handler func(ctx context.Context, flow *workflow.Flow, outerItem int) (inners []int, currentOuter int, err error)) *Mock
MockTaskO sets up a mock handler for TaskO.
func (*Mock) Nested ¶
Nested returns the workflow graph, or a mocked graph if MockNested was called.
func (*Mock) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
type Service ¶
type Service struct {
*Intermediate // IMPORTANT: Do not remove
// contains filtered or unexported fields
}
Service implements nestedfailfanoutflow.verify, a 3x3 nested forEach where one inner branch fails. Verifies that the other 8 inner branches still execute to completion and that the flow transitions to failed only after every inner has terminated.
func (*Service) JoinI ¶
JoinI is the inner cohort fan-in. Fires only for outer branches whose inner cohort had no failures - i.e. outer=0 and outer=2. The failed inner cohort (outer=1) never reaches this step because its failure is propagated to the outer cohort directly.
func (*Service) JoinO ¶
JoinO is the outer cohort fan-in. Never fires in this fixture because the outer cohort always has a failed branch (outer=1, whose inner cohort had a failure that propagated up).
func (*Service) Nested ¶
Nested defines the 3x3 nested forEach graph:
taskA --forEach(outers)--> taskO --forEach(inners)--> taskI --> joinI --> joinO --> END
Both joinI and joinO are SetFanIn nodes (inner and outer cohort fan-ins respectively).
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) ReleaseSlowInners ¶
func (svc *Service) ReleaseSlowInners()
ReleaseSlowInners closes the inner gate so the 8 non-failing inner tasks can complete. Called by the test after observing all 9 inner tasks have started.
func (*Service) TaskI ¶
func (svc *Service) TaskI(ctx context.Context, flow *workflow.Flow, currentOuter int, innerItem int) (err error)
TaskI is the per-(outer, inner) cell task. The cell (outer=1, inner=1) fails synchronously; every other cell blocks on the test gate so all 9 cells are demonstrably in flight at once.
func (*Service) TaskO ¶
func (svc *Service) TaskO(ctx context.Context, flow *workflow.Flow, outerItem int) (inners []int, currentOuter int, err error)
TaskO is the per-outer-branch task. It emits the inner forEach array and stamps the outer index onto state so each inner branch can identify its outer.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
TaskA(ctx context.Context, flow *workflow.Flow) (outers []int, err error) // MARKER: TaskA
TaskO(ctx context.Context, flow *workflow.Flow, outerItem int) (inners []int, currentOuter int, err error) // MARKER: TaskO
TaskI(ctx context.Context, flow *workflow.Flow, currentOuter int, innerItem int) (err error) // MARKER: TaskI
JoinI(ctx context.Context, flow *workflow.Flow) (err error) // MARKER: JoinI
JoinO(ctx context.Context, flow *workflow.Flow) (done bool, err error) // MARKER: JoinO
Nested(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Nested
}
ToDo is implemented by the service or mock.