DaemonInterface

Trait DaemonInterface 

Source
pub trait DaemonInterface: Clone {
    // Required methods
    fn create_instance(
        &self,
        flow: FlattenDataFlowDescriptor,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<Uuid>> + Send + '_>>;
    fn delete_instance(
        &self,
        instance_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<DataFlowRecord>> + Send + '_>>;
    fn instantiate(
        &self,
        flow: FlattenDataFlowDescriptor,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<Uuid>> + Send + '_>>;
    fn teardown(
        &self,
        instance_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<DataFlowRecord>> + Send + '_>>;
    fn start_instance(
        &self,
        instance_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<()>> + Send + '_>>;
    fn stop_instance(
        &self,
        instance_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<DataFlowRecord>> + Send + '_>>;
    fn start_node(
        &self,
        instance_id: Uuid,
        node: String,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<()>> + Send + '_>>;
    fn stop_node(
        &self,
        instance_id: Uuid,
        node: String,
    ) -> Pin<Box<dyn Future<Output = DaemonResult<()>> + Send + '_>>;

    // Provided method
    fn get_daemon_interface_server(
        self,
        z: Arc<Session>,
        id: Option<ZenohId>,
    ) -> ServeDaemonInterface<Self> { ... }
}
Expand description

The interface the Daemon expose to a client (eg. the cli, or, the mgmt API)1 The service is exposed using zenoh-rpc, the server and client are generated automatically.


  1. We may split this interface in the future. 

Required Methods§

Source

fn create_instance( &self, flow: FlattenDataFlowDescriptor, ) -> Pin<Box<dyn Future<Output = DaemonResult<Uuid>> + Send + '_>>

Creates an instance of the given FlattenDataFlowDescriptor1.

This function:

  1. Generates the instance Uuid
  2. Maps the flow into the infrastructure
  3. Creates the associated record
  4. Stores the record in Zenoh
  5. Prepares all the involved runtimes to host the data flow instance

Returns the Uuid associated with the instance.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • unable to map
  • unable to prepare nodes

  1. When the registry will be in place it will take the Flow identifier as parameter 

Source

fn delete_instance( &self, instance_id: Uuid, ) -> Pin<Box<dyn Future<Output = DaemonResult<DataFlowRecord>> + Send + '_>>

Deletes the given instance.

This function:

  1. Cleans the instance nodes from all the involved runtimes.
  2. Deletes the record from zenoh
§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • instance not stopped
  • unable to clean
  • zenoh error
Source

fn instantiate( &self, flow: FlattenDataFlowDescriptor, ) -> Pin<Box<dyn Future<Output = DaemonResult<Uuid>> + Send + '_>>

Instantiates the given FlattenDataFlowDescriptor1.

The instance contains an Uuid that identifies it uniquely. The actual instantiation process runs asynchronously in the runtime.

Returns the Uuid associated with the instance.

It is equivalent to calling create_instance and then start_instance.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • unable to instantiate

  1. When the registry will be in place it will take the Flow identifier as parameter. 

Source

fn teardown( &self, instance_id: Uuid, ) -> Pin<Box<dyn Future<Output = DaemonResult<DataFlowRecord>> + Send + '_>>

Sends a teardown request for the given instance identified by the Uuid.

Note that the request is asynchronous, the runtime that receives the request will return immediately, but the teardown process will run asynchronously in the runtime.

It is equivalent to calling stop_instance and then delete_instance.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • unable to teardown
  • instance not found
Source

fn start_instance( &self, instance_id: Uuid, ) -> Pin<Box<dyn Future<Output = DaemonResult<()>> + Send + '_>>

Starts the instance on all involved nodes.

It first starts all the nodes and then the sources.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • instance not found
  • instance already started
Source

fn stop_instance( &self, instance_id: Uuid, ) -> Pin<Box<dyn Future<Output = DaemonResult<DataFlowRecord>> + Send + '_>>

Stops the instance on all involved nodes.

It first stops the sources then the other nodes.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • unable to clean
Source

fn start_node( &self, instance_id: Uuid, node: String, ) -> Pin<Box<dyn Future<Output = DaemonResult<()>> + Send + '_>>

Starts the given graph node for the given instance. A graph node can be a source, a sink, a connector, or an operator.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • record not found
  • node already started
  • node not found
Source

fn stop_node( &self, instance_id: Uuid, node: String, ) -> Pin<Box<dyn Future<Output = DaemonResult<()>> + Send + '_>>

Stops the given graph node from the given instance. A graph node can be a source, a sink, a connector, or an operator.

§Errors

An error variant is returned in case of:

  • error on zenoh-rpc
  • instance not found
  • node not found
  • node already stopped

Provided Methods§

Source

fn get_daemon_interface_server( self, z: Arc<Session>, id: Option<ZenohId>, ) -> ServeDaemonInterface<Self>

Returns the server object

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§