Documentation ¶
Index ¶
- func LoadComponents(paths []string, factory *Factory) ([]string, error)
- func NewDefaultGraph() interface{}
- type Annotation
- type Component
- type ComponentInfo
- type Constructor
- type Done
- type Factory
- func (f *Factory) Annotate(componentName string, annotation Annotation) error
- func (f *Factory) Create(componentName string) (interface{}, error)
- func (f *Factory) Register(componentName string, constructor Constructor) error
- func (f *Factory) Size() int
- func (f *Factory) Unregister(componentName string) error
- type FactoryConfig
- type Graph
- func (n *Graph) Add(name string, c interface{}) error
- func (n *Graph) AddGraph(name string) error
- func (n *Graph) AddIIP(processName, portName string, data interface{}) error
- func (n *Graph) AddNew(processName string, componentName string, f *Factory) error
- func (n *Graph) Connect(senderName, senderPort, receiverName, receiverPort string) error
- func (n *Graph) ConnectBuf(senderName, senderPort, receiverName, receiverPort string, bufferSize int) error
- func (n *Graph) Get(name string) interface{}
- func (n *Graph) MapInPort(name, procName, procPort string)
- func (n *Graph) MapOutPort(name, procName, procPort string)
- func (n *Graph) Process()
- func (n *Graph) Remove(processName string) error
- func (n *Graph) RemoveIIP(processName, portName string) error
- func (n *Graph) SetInPort(name string, channel interface{}) error
- func (n *Graph) SetOutPort(name string, channel interface{}) error
- type GraphConfig
- type InputGuard
- type Message
- type PlugIn
- type PlugInS
- type PortInfo
- type Wait
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadComponents ¶
LoadComponents goes through all paths, opens all plugins in those paths and loads them into factory Plugins are denoted by *_goplug.so, The filename must begin with a capitolized letter
func NewDefaultGraph ¶
func NewDefaultGraph() interface{}
NewDefaultGraph is a ComponentConstructor for the factory
Types ¶
type Annotation ¶
type Annotation struct { // Description tells what the component does Description string // Icon name in Font Awesome is used for visualization Icon string }
Annotation provides reference information about a component to graph designers and operators
type Component ¶
type Component interface {
Process()
}
Component is a unit that can start a process
type ComponentInfo ¶
type ComponentInfo struct { Name string `json:"name"` Description string `json:"description"` Icon string `json:"icon"` Subgraph bool `json:"subgraph"` InPorts []PortInfo `json:"inPorts"` OutPorts []PortInfo `json:"outPorts"` }
ComponentInfo represents a component to a protocol client
type Constructor ¶
type Constructor func() (interface{}, error)
Constructor is used to create a component instance at run-time
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory registers components and creates their instances at run-time
func NewFactory ¶
func NewFactory(config ...FactoryConfig) *Factory
NewFactory creates a new component Factory instance
func (*Factory) Annotate ¶
func (f *Factory) Annotate(componentName string, annotation Annotation) error
Annotate adds human-readable documentation for a component to the runtime
func (*Factory) Create ¶
Create creates a new instance of a component registered under a specific name.
func (*Factory) Register ¶
func (f *Factory) Register(componentName string, constructor Constructor) error
Register registers a component so that it can be instantiated at run-time
func (*Factory) Unregister ¶
Unregister removes a component with a given name from the component registry and returns true or returns false if no such component is registered.
type FactoryConfig ¶
type FactoryConfig struct {
RegistryCapacity uint
}
FactoryConfig sets up properties of a Factory
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph represents a graph of processes connected with packet channels.
func LoadJSON ¶
LoadJSON loads a JSON graph definition file into a flow.Graph object that can be run or used in other networks
func NewGraph ¶
func NewGraph(config ...GraphConfig) *Graph
NewGraph returns a new initialized empty graph instance
func ParseJSON ¶
ParseJSON converts a JSON network definition string into a flow.Graph object that can be run or used in other networks
func (*Graph) AddGraph ¶
AddGraph adds a new blank graph instance to a network. That instance can be modified then at run-time.
func (*Graph) AddNew ¶
AddNew creates a new process instance using component factory and adds it to the network.
func (*Graph) Connect ¶
Connect connects a sender to a receiver and creates a channel between them using BufferSize configuratio nof the graph. Normally such a connection is unbuffered but you can change by setting flow.DefaultBufferSize > 0 or by using ConnectBuf() function instead. It returns true on success or panics and returns false if error occurs.
func (*Graph) ConnectBuf ¶
func (n *Graph) ConnectBuf(senderName, senderPort, receiverName, receiverPort string, bufferSize int) error
ConnectBuf connects a sender to a receiver using a channel with a buffer of a given size. It returns true on success or panics and returns false if error occurs.
func (*Graph) MapInPort ¶
MapInPort adds an inport to the net and maps it to a contained proc's port.
func (*Graph) MapOutPort ¶
MapOutPort adds an outport to the net and maps it to a contained proc's port.
func (*Graph) Remove ¶
Remove deletes a process from the graph. First it stops the process if running. Then it disconnects it from other processes and removes the connections from the graph. Then it drops the process itself.
func (*Graph) SetInPort ¶
SetInPort assigns a channel to a network's inport to talk to the outer world.
func (*Graph) SetOutPort ¶
SetOutPort assigns a channel to a network's outport to talk to the outer world. It returns true on success or false if the outport cannot be set.
type GraphConfig ¶
GraphConfig sets up properties for a graph
type InputGuard ¶
type InputGuard struct {
// contains filtered or unexported fields
}
InputGuard counts number of closed inputs
func NewInputGuard ¶
func NewInputGuard(ports ...string) *InputGuard
NewInputGuard returns a guard for a given number of inputs
func (*InputGuard) Complete ¶
func (g *InputGuard) Complete(port string) bool
Complete is called when a port is closed and returns true when all the ports have been closed
type Message ¶
type Message struct { // Protocol is NoFlo protocol identifier: // "runtime", "component", "graph" or "network" Protocol string `json:"protocol"` // Command is a command to be executed within the protocol Command string `json:"command"` // Payload is JSON-encoded body of the message Payload interface{} `json:"payload"` }
Message represents a single FBP protocol message
type PlugIn ¶
type PlugIn interface { Component SetParams(params map[string]interface{}) error GetParams() map[string]interface{} GetParam(param string) interface{} }
PlugIn something
type PortInfo ¶
type PortInfo struct { ID string `json:"id"` Type string `json:"type"` Description string `json:"description"` Addressable bool `json:"addressable"` // ignored Required bool `json:"required"` Values []interface{} `json:"values"` // ignored Default interface{} `json:"default"` // ignored }
PortInfo represents a port to a runtime client