Documentation
¶
Index ¶
- Constants
- type Config
- type Edge
- type EnvHandler
- type Envelope
- type EnvelopeWorker
- type ErrorLevel
- type Event
- type EventWorker
- type EvtHandler
- type Graph
- func (g *Graph) AddEdge(edge MessageCarrier) *Graph
- func (g *Graph) AddNode(supervisor EventWorker, node EnvelopeWorker) *Graph
- func (g *Graph) AddSupervisor(parent EventWorker, supervisor EventWorker) *Graph
- func (g *Graph) Metrics(nodes []string) []*Metrics
- func (g *Graph) Start(ctx context.Context) *Graph
- func (g *Graph) Stop() *Graph
- type Message
- type MessageCarrier
- type Metrics
- type Node
- func (n *Node[In, Out]) AddInput(edge MessageCarrier)
- func (n *Node[In, Out]) AddOutput(edge MessageCarrier)
- func (n *Node[In, Out]) AddWorkers(edge MessageCarrier, num int, name string, handler EnvHandler)
- func (n *Node[In, Out]) GetHandler() EnvHandler
- func (n *Node[In, Out]) GetMetrics() *Metrics
- func (n *Node[In, Out]) Name() string
- func (n *Node[In, Out]) Restart(evt *Event)
- func (n *Node[In, Out]) RestartWorkers(ctx context.Context)
- func (n *Node[In, Out]) RunningWorkerCount() int
- func (n *Node[In, Out]) SendEvent(evt *Event)
- func (n *Node[In, Out]) SetEvents(edge MessageCarrier)
- func (n *Node[In, Out]) Start(ctx context.Context)
- func (n *Node[In, Out]) Stop(evt *Event)
- func (n *Node[In, Out]) StopWorkers()
- type OutMux
- type Supervisor
- type Worker
Constants ¶
View Source
const DefaultErrorLevel = ErrorLevelInfo
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
func (*Edge) GetChannel ¶
func (*Edge) SetChannel ¶
type EnvHandler ¶
type Envelope ¶
func NewEnvelope ¶
type EnvelopeWorker ¶
type EnvelopeWorker interface {
Name() string
AddOutput(MessageCarrier)
AddInput(MessageCarrier)
AddWorkers(MessageCarrier, int, string, EnvHandler)
GetHandler() EnvHandler
SetEvents(MessageCarrier)
Start(context.Context)
RestartWorkers(context.Context)
Stop(*Event)
GetMetrics() *Metrics
}
type ErrorLevel ¶
type ErrorLevel int
ErrorLevel represents the severity of an error.
const ( // ErrorLevelDefault selects the default error level. ErrorLevelDefault ErrorLevel = iota // ErrorLevelDebug represents a very granular message. ErrorLevelDebug // ErrorLevelInfo represents an informational message. ErrorLevelInfo // ErrorLevelWarning represents a warning message. ErrorLevelWarning // ErrorLevelError represents an error message. ErrorLevelError // ErrorLevelCritical represents a critical error message. ErrorLevelCritical // Done is a special error level that indicates the end of a process. Done )
func (ErrorLevel) Level ¶
func (level ErrorLevel) Level() string
String returns the string representation of the error level.
func (ErrorLevel) String ¶
func (e ErrorLevel) String() string
type Event ¶
type Event struct {
Worker string
// contains filtered or unexported fields
}
func (*Event) Level ¶
func (e *Event) Level() ErrorLevel
type EventWorker ¶
type EventWorker interface {
Name() string
AddChildSupervisor(EventWorker)
SetEvents(MessageCarrier)
SetCancel(context.CancelFunc)
Start(ctx context.Context)
Stop()
}
type EvtHandler ¶
type Graph ¶
type Graph struct {
Name string
Supervisors map[string]EventWorker
Nodes map[string]EnvelopeWorker
Edges []MessageCarrier
// contains filtered or unexported fields
}
func (*Graph) AddEdge ¶
func (g *Graph) AddEdge(edge MessageCarrier) *Graph
func (*Graph) AddNode ¶
func (g *Graph) AddNode(supervisor EventWorker, node EnvelopeWorker) *Graph
func (*Graph) AddSupervisor ¶
func (g *Graph) AddSupervisor(parent EventWorker, supervisor EventWorker) *Graph
type MessageCarrier ¶
type MessageCarrier interface {
Name() string
Send(env Message) error
GetChannel() chan Message
SetChannel(chan Message)
Close()
}
func NewEdge ¶
func NewEdge(name string, fn EnvelopeWorker, tn EnvelopeWorker, bufferSize int, numWorkers int) MessageCarrier
type Node ¶
type Node[In, Out Message] struct { Handler EnvHandler LoopbackHandler EnvHandler WorkerPool map[string][]*Worker WorkerCounter uint64 RunningWorkers int64 In map[string]MessageCarrier Out OutMux Events MessageCarrier // contains filtered or unexported fields }
func NewNode ¶
func NewNode[In, Out Message](name string, handler, lbHandler EnvHandler) *Node[In, Out]
func (*Node[In, Out]) AddInput ¶
func (n *Node[In, Out]) AddInput(edge MessageCarrier)
func (*Node[In, Out]) AddOutput ¶
func (n *Node[In, Out]) AddOutput(edge MessageCarrier)
func (*Node[In, Out]) AddWorkers ¶
func (n *Node[In, Out]) AddWorkers(edge MessageCarrier, num int, name string, handler EnvHandler)
func (*Node[In, Out]) GetHandler ¶
func (n *Node[In, Out]) GetHandler() EnvHandler
func (*Node[In, Out]) GetMetrics ¶
func (*Node[In, Out]) RestartWorkers ¶
func (*Node[In, Out]) RunningWorkerCount ¶
func (*Node[In, Out]) SetEvents ¶
func (n *Node[In, Out]) SetEvents(edge MessageCarrier)
func (*Node[In, Out]) StopWorkers ¶
func (n *Node[In, Out]) StopWorkers()
type OutMux ¶
type OutMux struct {
Name string
OutChans map[string]MessageCarrier
GoChans map[string]MessageCarrier
}
func (*OutMux) AddChannel ¶
func (o *OutMux) AddChannel(edge MessageCarrier)
type Supervisor ¶
type Supervisor struct {
Events MessageCarrier
ParentEvents MessageCarrier
Supervisors map[string]EventWorker
Nodes map[string]EnvelopeWorker
Handler EvtHandler
// contains filtered or unexported fields
}
func NewSupervisor ¶
func NewSupervisor(name string, handler EvtHandler) *Supervisor
func (*Supervisor) AddChildSupervisor ¶
func (s *Supervisor) AddChildSupervisor(supervisor EventWorker)
func (*Supervisor) Name ¶
func (s *Supervisor) Name() string
func (*Supervisor) SetCancel ¶
func (s *Supervisor) SetCancel(cancel context.CancelFunc)
func (*Supervisor) SetEvents ¶
func (s *Supervisor) SetEvents(edge MessageCarrier)
func (*Supervisor) Start ¶
func (s *Supervisor) Start(ctx context.Context)
func (*Supervisor) Stop ¶
func (s *Supervisor) Stop()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.