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) MockParent(...) *Mock
- func (svc *Mock) MockRunInner(...) *Mock
- func (svc *Mock) MockTaskA(...) *Mock
- func (svc *Mock) MockTaskX(...) *Mock
- func (svc *Mock) MockTaskY(...) *Mock
- func (svc *Mock) MockTaskZ(...) *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) (graph *workflow.Graph, err error)
- func (svc *Mock) RunInner(ctx context.Context, flow *workflow.Flow, seed string) (innerResult string, err error)
- func (svc *Mock) TaskA(ctx context.Context, flow *workflow.Flow, seed string) (seedOut string, err error)
- func (svc *Mock) TaskX(ctx context.Context, flow *workflow.Flow, seed string) (innerStage string, err error)
- func (svc *Mock) TaskY(ctx context.Context, flow *workflow.Flow, innerStage string) (innerResult string, err error)
- func (svc *Mock) TaskZ(ctx context.Context, flow *workflow.Flow, innerResult string) (finalResult string, 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) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Parent(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) RunInner(ctx context.Context, flow *workflow.Flow, seed string) (innerResult string, err error)
- func (svc *Service) TaskA(ctx context.Context, flow *workflow.Flow, seed string) (seedOut string, err error)
- func (svc *Service) TaskX(ctx context.Context, flow *workflow.Flow, seed string) (innerStage string, err error)
- func (svc *Service) TaskY(ctx context.Context, flow *workflow.Flow, innerStage string) (innerResult string, err error)
- func (svc *Service) TaskZ(ctx context.Context, flow *workflow.Flow, innerResult string) (finalResult string, err error)
- type ToDo
Constants ¶
const ( Hostname = subgraphflowapi.Hostname Version = 2 )
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, seed string) (innerResult string, 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) MockParent ¶
func (svc *Mock) MockParent(handler func(ctx context.Context, flow *workflow.Flow, seed string) (finalResult string, err error)) *Mock
MockParent sets up a mock handler for the Parent workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.
func (*Mock) MockRunInner ¶ added in v1.37.0
func (svc *Mock) MockRunInner(handler func(ctx context.Context, flow *workflow.Flow, seed string) (innerResult string, err error)) *Mock
MockRunInner sets up a mock handler for RunInner.
func (*Mock) MockTaskA ¶
func (svc *Mock) MockTaskA(handler func(ctx context.Context, flow *workflow.Flow, seed string) (seedOut string, err error)) *Mock
MockTaskA sets up a mock handler for TaskA.
func (*Mock) MockTaskX ¶
func (svc *Mock) MockTaskX(handler func(ctx context.Context, flow *workflow.Flow, seed string) (innerStage string, 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, innerStage string) (innerResult string, 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, innerResult string) (finalResult string, err error)) *Mock
MockTaskZ sets up a mock handler for TaskZ.
func (*Mock) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Mock) Parent ¶
Parent returns the workflow graph, or a mocked graph if MockParent was called.
func (*Mock) RunInner ¶ added in v1.37.0
func (svc *Mock) RunInner(ctx context.Context, flow *workflow.Flow, seed string) (innerResult string, err error)
RunInner executes the mock handler.
func (*Mock) TaskA ¶
func (svc *Mock) TaskA(ctx context.Context, flow *workflow.Flow, seed string) (seedOut string, err error)
TaskA executes the mock handler.
func (*Mock) TaskX ¶
func (svc *Mock) TaskX(ctx context.Context, flow *workflow.Flow, seed string) (innerStage string, err error)
TaskX executes the mock handler.
type Service ¶
type Service struct {
*Intermediate // IMPORTANT: Do not remove
}
Service implements subgraphflow.verify, exercising subgraph invocation.
func (*Service) Inner ¶
Inner defines the subgraph X -> Y. It declares `seed` as input and `innerResult` as output; the parent step's state crosses the boundary filtered through these.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) RunInner ¶ added in v1.37.0
func (svc *Service) RunInner(ctx context.Context, flow *workflow.Flow, seed string) (innerResult string, err error)
RunInner invokes the Inner subgraph via flow.Subgraph and adopts its `innerResult` output into parent state. Parks on the first call, then re-runs with the child's result and returns it.
func (*Service) TaskA ¶
func (svc *Service) TaskA(ctx context.Context, flow *workflow.Flow, seed string) (seedOut string, err error)
TaskA passes the seed through.
func (*Service) TaskX ¶
func (svc *Service) TaskX(ctx context.Context, flow *workflow.Flow, seed string) (innerStage string, err error)
TaskX is the subgraph entry. It reads `seed` and writes `innerStage`.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
TaskA(ctx context.Context, flow *workflow.Flow, seed string) (seedOut string, err error) // MARKER: TaskA
TaskX(ctx context.Context, flow *workflow.Flow, seed string) (innerStage string, err error) // MARKER: TaskX
TaskY(ctx context.Context, flow *workflow.Flow, innerStage string) (innerResult string, err error) // MARKER: TaskY
TaskZ(ctx context.Context, flow *workflow.Flow, innerResult string) (finalResult string, err error) // MARKER: TaskZ
RunInner(ctx context.Context, flow *workflow.Flow, seed string) (innerResult string, err error) // MARKER: RunInner
Inner(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Inner
Parent(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Parent
}
ToDo is implemented by the service or mock.