Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) DynamicSubgraph(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) Inner(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) InnerA(ctx context.Context, flow *workflow.Flow, value int) (innerStage int, err error)
- func (svc *Mock) InnerB(ctx context.Context, flow *workflow.Flow, innerStage int) (innerResult int, innerDone bool, err error)
- func (svc *Mock) MockDynamicSubgraph(...) *Mock
- func (svc *Mock) MockInner(...) *Mock
- func (svc *Mock) MockInnerA(...) *Mock
- func (svc *Mock) MockInnerB(...) *Mock
- func (svc *Mock) MockParent(...) *Mock
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- func (svc *Mock) Parent(ctx context.Context, flow *workflow.Flow, value int, innerDone bool, ...) (parentResult string, err error)
- type Service
- func (svc *Service) DynamicSubgraph(ctx context.Context) (graph *workflow.Graph, err error)
- 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) InnerA(ctx context.Context, flow *workflow.Flow, value int) (innerStage int, err error)
- func (svc *Service) InnerB(ctx context.Context, flow *workflow.Flow, innerStage int) (innerResult int, innerDone bool, err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Parent(ctx context.Context, flow *workflow.Flow, value int, innerDone bool, ...) (parentResult string, err error)
- type ToDo
Constants ¶
const ( Hostname = dynamicsubgraphflowapi.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) DynamicSubgraph ¶
DynamicSubgraph returns the workflow graph, or a mocked graph if MockDynamicSubgraph was called.
func (*Mock) InnerA ¶
func (svc *Mock) InnerA(ctx context.Context, flow *workflow.Flow, value int) (innerStage int, err error)
InnerA executes the mock handler.
func (*Mock) InnerB ¶
func (svc *Mock) InnerB(ctx context.Context, flow *workflow.Flow, innerStage int) (innerResult int, innerDone bool, err error)
InnerB executes the mock handler.
func (*Mock) MockDynamicSubgraph ¶
func (svc *Mock) MockDynamicSubgraph(handler func(ctx context.Context, flow *workflow.Flow, value int) (parentResult string, err error)) *Mock
MockDynamicSubgraph sets up a mock handler for the DynamicSubgraph workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.
func (*Mock) MockInner ¶
func (svc *Mock) MockInner(handler func(ctx context.Context, flow *workflow.Flow, value int) (innerResult int, innerDone bool, 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) MockInnerA ¶
func (svc *Mock) MockInnerA(handler func(ctx context.Context, flow *workflow.Flow, value int) (innerStage int, err error)) *Mock
MockInnerA sets up a mock handler for InnerA.
func (*Mock) MockInnerB ¶
func (svc *Mock) MockInnerB(handler func(ctx context.Context, flow *workflow.Flow, innerStage int) (innerResult int, innerDone bool, err error)) *Mock
MockInnerB sets up a mock handler for InnerB.
func (*Mock) MockParent ¶
func (svc *Mock) MockParent(handler func(ctx context.Context, flow *workflow.Flow, value int, innerDone bool, innerResult int) (parentResult string, err error)) *Mock
MockParent sets up a mock handler for Parent.
func (*Mock) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
type Service ¶
type Service struct {
*Intermediate // IMPORTANT: Do not remove
}
Service implements dynamicsubgraphflow.verify, exercising the flow.Subgraph control signal.
func (*Service) DynamicSubgraph ¶
DynamicSubgraph defines a single-task parent graph that dynamically invokes Inner.
func (*Service) InnerA ¶
func (svc *Service) InnerA(ctx context.Context, flow *workflow.Flow, value int) (innerStage int, err error)
InnerA doubles value.
func (*Service) InnerB ¶
func (svc *Service) InnerB(ctx context.Context, flow *workflow.Flow, innerStage int) (innerResult int, innerDone bool, err error)
InnerB adds 3 to innerStage and marks the inner subgraph done.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) Parent ¶
func (svc *Service) Parent(ctx context.Context, flow *workflow.Flow, value int, innerDone bool, innerResult int) (parentResult string, err error)
Parent calls flow.Subgraph on its first invocation, then re-runs after the child completes with the child's outputs (innerDone, innerResult) merged into state.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
Parent(ctx context.Context, flow *workflow.Flow, value int, innerDone bool, innerResult int) (parentResult string, err error) // MARKER: Parent
InnerA(ctx context.Context, flow *workflow.Flow, value int) (innerStage int, err error) // MARKER: InnerA
InnerB(ctx context.Context, flow *workflow.Flow, innerStage int) (innerResult int, innerDone bool, err error) // MARKER: InnerB
Inner(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Inner
DynamicSubgraph(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: DynamicSubgraph
}
ToDo is implemented by the service or mock.