Firebird: Difference between revisions

From stonehomewiki
Jump to navigationJump to search
Line 14: Line 14:
Represent a node in the pipeline. A node can have bunch of input ports and bunch of output ports. Each port has a unique name within the node.
Represent a node in the pipeline. A node can have bunch of input ports and bunch of output ports. Each port has a unique name within the node.


* (property) name: the name of the node, it is unique within a pipeline
Properties:
* name: the name of the node, it is unique within a pipeline
* INPUT:  a dictionary like object, allowing you to get input port by name, e.g. <nowiki>node.INPUT["foo"]</nowiki> will return the input port with name "foo"
* INPUT:  a dictionary like object, allowing you to get input port by name, e.g. <nowiki>node.INPUT["foo"]</nowiki> will return the input port with name "foo"
* input: the default input port, e.g. node.input
* input: the default input port, e.g. node.input
* OUTPUT: a dictionary like object, allowing you to get output port by name, e.g. <nowiki>node.OUTPUT["foo"]</nowiki> will return the output port with name "foo"
* OUTPUT: a dictionary like object, allowing you to get output port by name, e.g. <nowiki>node.OUTPUT["foo"]</nowiki> will return the output port with name "foo"
* output: the default input port, e.g. node.output
* output: the default input port, e.g. node.output
Methods:
<pre><nowiki>
on_message(self, name:str, data:Any)
This method will be called for this node to handle data point, data is a json object, name represent from which port the data is received.
</nowiki></pre>
<pre><nowiki>
def connect(self, *dest_ports:Union["Node", "Port"]) -> "Port"
# connect the default output port to a input port of a node
# if dest_port element is a Node, then the default input port is used
</nowiki></pre>
<pre><nowiki>
def emit(self, data:Any, name:str=DEFAULT_PORT_NAME)
# emit data to it's output port specified by name
</nowiki></pre>





Revision as of 07:07, 17 April 2023

Firebird -- Python based Streaming Framework

APIs