Documentation
¶
Index ¶
- func RegisterCodec[I, O any](nb *Builder, middleFunc node.MiddleFunc[I, O])
- func RegisterMiddle[CFG, I, O any](nb *Builder, b stage.MiddleProvider[CFG, I, O])
- func RegisterStart[CFG, O any](nb *Builder, b stage.StartProvider[CFG, O])
- func RegisterTerminal[CFG, I any](nb *Builder, b stage.TerminalProvider[CFG, I])
- type Builder
- type ConnectedConfig
- type Connector
- type Graph
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCodec ¶
func RegisterCodec[I, O any](nb *Builder, middleFunc node.MiddleFunc[I, O])
RegisterCodec registers a Codec into the graph builder. A Codec is a node.MiddleFunc function that allows converting data types and it's automatically inserted when a node with a given output type is connected to a node with a different input type. When nodes with different types are connected, a codec converting between both MUST have been registered previously. Otherwise the graph Build method will fail.
func RegisterMiddle ¶
func RegisterMiddle[CFG, I, O any](nb *Builder, b stage.MiddleProvider[CFG, I, O])
RegisterMiddle registers a stage.MiddleProvider into the graph builder. When the Build method is invoked later, any configuration field associated with the MiddleProvider will result in the instantiation of a node.Middle with the provider's returned function.
func RegisterStart ¶
func RegisterStart[CFG, O any](nb *Builder, b stage.StartProvider[CFG, O])
RegisterStart registers a stage.StartProvider into the graph builder. When the Build method is invoked later, any configuration field associated with the StartProvider will result in the instantiation of a node.Start with the provider's returned function.
func RegisterTerminal ¶
func RegisterTerminal[CFG, I any](nb *Builder, b stage.TerminalProvider[CFG, I])
RegisterTerminal registers a stage.TerminalProvider into the graph builder. When the Build method is invoked later, any configuration field associated with the TerminalProvider will result in the instantiation of a node.Terminal with the provider's returned function.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder helps to build a graph and to connect their nodes. It takes care of instantiating all its stages given a name and a type, as well as connect them. If two connected stages have incompatible types, it will insert a codec in between to translate between the stage types
func NewBuilder ¶
NewBuilder instantiates a Graph Builder with the default configuration, which can be overridden via the arguments.
type ConnectedConfig ¶
type ConnectedConfig interface {
// Connections returns a map representing the connection of the node graphs, where
// the key contains the instance ID of the source node, and the value contains an
// array of the destination nodes' instance IDs.
Connections() map[string][]string
}
ConnectedConfig describes the interface that any struct passed to the builder.Build method must fullfill. Consider embedding the Connector type into your struct for automatic implementation of the interface.
type Connector ¶
Connector is a convenience implementor of the ConnectedConfig interface, required to build any graph. It can be embedded into any configuration struct that is passed as argument into the builder.Build method.
Key: instance ID of the source node. Value: array of destination node instance IDs.
func (Connector) Connections ¶
Connections returns the connection map represented by the Connector