nestedfailfanoutflow

package
v1.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = nestedfailfanoutflowapi.Hostname
	Version  = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate

type Intermediate struct {
	*connector.Connector
	ToDo
}

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 NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) JoinI

func (svc *Mock) JoinI(ctx context.Context, flow *workflow.Flow) (err error)

JoinI executes the mock handler.

func (*Mock) JoinO

func (svc *Mock) JoinO(ctx context.Context, flow *workflow.Flow) (done bool, err error)

JoinO executes the mock handler.

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

func (svc *Mock) Nested(ctx context.Context) (graph *workflow.Graph, err error)

Nested returns the workflow graph, or a mocked graph if MockNested was called.

func (*Mock) OnShutdown

func (svc *Mock) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup

func (svc *Mock) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

func (*Mock) TaskA

func (svc *Mock) TaskA(ctx context.Context, flow *workflow.Flow) (outers []int, err error)

TaskA executes the mock handler.

func (*Mock) TaskI

func (svc *Mock) TaskI(ctx context.Context, flow *workflow.Flow, currentOuter int, innerItem int) (err error)

TaskI executes the mock handler.

func (*Mock) TaskO

func (svc *Mock) TaskO(ctx context.Context, flow *workflow.Flow, outerItem int) (inners []int, currentOuter int, err error)

TaskO executes the mock handler.

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 NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) Counters

func (svc *Service) Counters() (innerStarts, innerCompleted, joinIRuns, joinORuns int)

Counters returns the current execution counters under the service lock.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service

Init enables a single-statement pattern for initializing the microservice.

func (*Service) JoinI

func (svc *Service) JoinI(ctx context.Context, flow *workflow.Flow) (err error)

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

func (svc *Service) JoinO(ctx context.Context, flow *workflow.Flow) (done bool, err error)

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

func (svc *Service) Nested(ctx context.Context) (graph *workflow.Graph, err error)

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

func (svc *Service) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

func (svc *Service) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

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) TaskA

func (svc *Service) TaskA(ctx context.Context, flow *workflow.Flow) (outers []int, err error)

TaskA is the entry that emits the outer forEach array.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL