Skip to content

Node descriptor

J-Loudet edited this page Jan 23, 2023 · 2 revisions

Table of contents

  1. (optional) Vars
  2. (optional) Configuration
  3. Inputs and Outputs
  4. URI

Node descriptors tell Zenoh-Flow how a node can be connected and where its actual implementation can be found. The descriptors detail the following information:

  • an id --- this field is for display purposes when Zenoh-Flow will provide a registry,
  • (optional) some vars,
  • (optional) some configuration,
  • its input(s) --- only for an Operator and a Sink,
  • its output(s) --- only for a Source and an Operator,
  • a uri --- where the implementation of the node can be found.

Below is the descriptor of an Operator that we will use to explain each section. The only difference with Source and Sink descriptors is in their lack of inputs/outputs: (as indicated in the comments) a Source only has outputs while a Sink only has inputs.

id: my-operator

# (optional)
vars:
  BASE_PATH: /home/zenoh/my-first-flow/nodes
  DLL_EXTENSION: so
  
# (optional)
configuration:
  default_timeout: 10
  
# Only OPERATOR and SINK
inputs:
  - id: in
    type: _any_
    
  - id: tick
    type: Int
    
# Only OPERATOR and SOURCE
outputs:
  - id: out
    type: String
    
uri: "file://{{ BASE_PATH }}/target/release/libmy_operator.{{ DLL_EXTENSION }}"

(optional) Vars

This section is used to tell Zenoh-Flow how to do string replacements in this descriptor (and only this one). More details can be found here.

(optional) Configuration

This section allows passing a dictionary of key-value pairs to all the nodes involved. This can be useful, for instance, to run several times the same node but with slightly different parameters or to modify the behaviour of a node without having to recompile it.

An in-depth explanation can be found here.

Inputs and Outputs

Both specify the same two information, for each Input or Output:

  • a unique (per category) identifier id,
  • an associated type that Zenoh-Flow will use to "enforce" compatible types.

Identifiers must be unique per category. What this means is that Zenoh-Flow will refuse a descriptor where two inputs (resp. outputs) share the same, but will accept a descriptor where an input and an output share the same id.

The type verification is strictly enforced but purely indicative: Zenoh-Flow will simply perform a string equality test between two ports of two different descriptors. If both types are equal but the data exchanged are incompatible then an error will still occur at runtime.

💡 There is a special value that turns off this verification. If the associated type is equal to _any_ then Zenoh-Flow will not perform any type equality check.

URI

This specifies where to find, on the device where the daemon is running, the implementation of the node being described.

The scheme file:// must be added and is, for now, the only one supported. We plan on supporting other schemes with the introduction of the registry in an upcoming release.