Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) Inner(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) MockInner(...) *Mock
- func (svc *Mock) MockNested(...) *Mock
- func (svc *Mock) MockNormalB(...) *Mock
- func (svc *Mock) MockTaskA(...) *Mock
- func (svc *Mock) MockTaskJ(...) *Mock
- func (svc *Mock) MockTaskW(...) *Mock
- func (svc *Mock) MockTaskX(...) *Mock
- func (svc *Mock) MockTaskY(...) *Mock
- func (svc *Mock) MockTaskZ(...) *Mock
- func (svc *Mock) Nested(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) NormalB(ctx context.Context, flow *workflow.Flow) (normalResult string, 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) (started bool, err error)
- func (svc *Mock) TaskJ(ctx context.Context, flow *workflow.Flow, normalResult string, innerResult int) (finalResult string, err error)
- func (svc *Mock) TaskW(ctx context.Context, flow *workflow.Flow, sumInner int) (innerResult int, err error)
- func (svc *Mock) TaskX(ctx context.Context, flow *workflow.Flow) (innerStarted bool, err error)
- func (svc *Mock) TaskY(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error)
- func (svc *Mock) TaskZ(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error)
- type Service
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) Inner(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) Nested(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) NormalB(ctx context.Context, flow *workflow.Flow) (normalResult string, err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) TaskA(ctx context.Context, flow *workflow.Flow) (started bool, err error)
- func (svc *Service) TaskJ(ctx context.Context, flow *workflow.Flow, normalResult string, innerResult int) (finalResult string, err error)
- func (svc *Service) TaskW(ctx context.Context, flow *workflow.Flow, sumInner int) (innerResult int, err error)
- func (svc *Service) TaskX(ctx context.Context, flow *workflow.Flow) (innerStarted bool, err error)
- func (svc *Service) TaskY(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error)
- func (svc *Service) TaskZ(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error)
- type ToDo
Constants ¶
const ( Hostname = nestedfanoutflowapi.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, allowing functions, event sinks and web handlers to be mocked.
func (*Mock) MockInner ¶
func (svc *Mock) MockInner(handler func(ctx context.Context, flow *workflow.Flow) (innerResult int, err error)) *Mock
MockInner sets up a mock handler for the Inner workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.
func (*Mock) MockNested ¶
func (svc *Mock) MockNested(handler func(ctx context.Context, flow *workflow.Flow) (finalResult string, err error)) *Mock
MockNested sets up a mock handler for the Nested workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.
func (*Mock) MockNormalB ¶
func (svc *Mock) MockNormalB(handler func(ctx context.Context, flow *workflow.Flow) (normalResult string, err error)) *Mock
MockNormalB sets up a mock handler for NormalB.
func (*Mock) MockTaskA ¶
func (svc *Mock) MockTaskA(handler func(ctx context.Context, flow *workflow.Flow) (started bool, err error)) *Mock
MockTaskA sets up a mock handler for TaskA.
func (*Mock) MockTaskJ ¶
func (svc *Mock) MockTaskJ(handler func(ctx context.Context, flow *workflow.Flow, normalResult string, innerResult int) (finalResult string, err error)) *Mock
MockTaskJ sets up a mock handler for TaskJ.
func (*Mock) MockTaskW ¶
func (svc *Mock) MockTaskW(handler func(ctx context.Context, flow *workflow.Flow, sumInner int) (innerResult int, err error)) *Mock
MockTaskW sets up a mock handler for TaskW.
func (*Mock) MockTaskX ¶
func (svc *Mock) MockTaskX(handler func(ctx context.Context, flow *workflow.Flow) (innerStarted bool, err error)) *Mock
MockTaskX sets up a mock handler for TaskX.
func (*Mock) MockTaskY ¶
func (svc *Mock) MockTaskY(handler func(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error)) *Mock
MockTaskY sets up a mock handler for TaskY.
func (*Mock) MockTaskZ ¶
func (svc *Mock) MockTaskZ(handler func(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error)) *Mock
MockTaskZ sets up a mock handler for TaskZ.
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.
func (*Mock) TaskJ ¶
func (svc *Mock) TaskJ(ctx context.Context, flow *workflow.Flow, normalResult string, innerResult int) (finalResult string, err error)
TaskJ executes the mock handler.
func (*Mock) TaskW ¶
func (svc *Mock) TaskW(ctx context.Context, flow *workflow.Flow, sumInner int) (innerResult int, err error)
TaskW executes the mock handler.
type Service ¶
type Service struct {
*Intermediate // IMPORTANT: Do not remove
}
Service implements nestedfanoutflow.verify, exercising two-level nested fan-out via the subgraph escape hatch.
func (*Service) NormalB ¶
func (svc *Service) NormalB(ctx context.Context, flow *workflow.Flow) (normalResult string, err error)
NormalB is the non-subgraph sibling of the outer fan-out.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) TaskJ ¶
func (svc *Service) TaskJ(ctx context.Context, flow *workflow.Flow, normalResult string, innerResult int) (finalResult string, err error)
TaskJ is the outer fan-in; combines NormalB's result with the inner subgraph's result.
func (*Service) TaskW ¶
func (svc *Service) TaskW(ctx context.Context, flow *workflow.Flow, sumInner int) (innerResult int, err error)
TaskW is the inner subgraph fan-in; reads the merged sumInner.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
TaskA(ctx context.Context, flow *workflow.Flow) (started bool, err error) // MARKER: TaskA
NormalB(ctx context.Context, flow *workflow.Flow) (normalResult string, err error) // MARKER: NormalB
TaskX(ctx context.Context, flow *workflow.Flow) (innerStarted bool, err error) // MARKER: TaskX
TaskY(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error) // MARKER: TaskY
TaskZ(ctx context.Context, flow *workflow.Flow) (sumInnerOut int, err error) // MARKER: TaskZ
TaskW(ctx context.Context, flow *workflow.Flow, sumInner int) (innerResult int, err error) // MARKER: TaskW
TaskJ(ctx context.Context, flow *workflow.Flow, normalResult string, innerResult int) (finalResult string, err error) // MARKER: TaskJ
Inner(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Inner
Nested(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Nested
}
ToDo is implemented by the service or mock.