Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) Fairness(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) MockFairness(...) *Mock
- func (svc *Mock) MockTally(...) *Mock
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- func (svc *Mock) Tally(ctx context.Context, flow *workflow.Flow) (tallied bool, err error)
- type Service
- func (svc *Service) Fairness(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Order() []string
- func (svc *Service) Tally(ctx context.Context, flow *workflow.Flow) (tallied bool, err error)
- type ToDo
Constants ¶
const ( Hostname = fairnessflowapi.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) Fairness ¶
Fairness returns the workflow graph, or a mocked graph if MockFairness was called.
func (*Mock) MockFairness ¶
func (svc *Mock) MockFairness(handler func(ctx context.Context, flow *workflow.Flow, tag string, delayMs int) (tallied bool, err error)) *Mock
MockFairness sets up a mock handler for the Fairness workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.
func (*Mock) MockTally ¶
func (svc *Mock) MockTally(handler func(ctx context.Context, flow *workflow.Flow) (tallied bool, err error)) *Mock
MockTally sets up a mock handler for Tally.
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 fairnessflow.verify, exercising two-level weighted fairness across fairness keys.
func (*Service) Fairness ¶
Fairness defines the single-task graph (tally -> END) used to observe weighted dispatch share across fairness keys. The graph carries no timing; the fairness key and weight are per-flow options at Create.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) Order ¶
Order returns the tags in the order their flows were dispatched, oldest first.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
Tally(ctx context.Context, flow *workflow.Flow) (tallied bool, err error) // MARKER: Tally
Fairness(ctx context.Context) (graph *workflow.Graph, err error) // MARKER: Fairness
}
ToDo is implemented by the service or mock.