Skip to content

arrowhead-f/client-adapter-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

client-adapter-rust

Overview

The client-adapter-rust software package enables application developers and system integrators to create distributed IIoT solutions in compliance with the Arrowhead framework specification by delivering client-side implementation of the mandatory Arrowhead core services (version 4.4.0). client-adapter-rust is written in Rust and makes use of open source libraries available on crates.io. It is released both as a software library for application developers and as executable configuration tool for system integrators.

Qt/C++ implementation

This software is develped upon a specification which is (roughly) the same as that of client-adapter-qt which is released under GNU LGPL license and is available here. The key differences are the following:

  • client-adapter-rust only providers interface for mandatory core systems (Service Registry, Orchestrator and Authorization) while client-adapter-qt makes use of onboarding core systems (Onboarding Controller, Device Registry, System Registry) too.
  • client-adapter-qt also contains pre-built Docker images for easier deployment

Getting started

Build from source

client-adapter-rust consists of two Cargo projects (ah_system_adapter and ah_adapter_app). You can use standard Cargo commands (cargo build, cargo run, cargo test) to build, execute or test the source code.

To learn more about the installation of Cargo, follow this link.

Documentation

Table of Contents

ah_system_adapter

ah_system_adapter is a Cargo package containing a library crate with the same name. It also contains some related unit tests.

Prerequisites

The reader is required to have a good understanding of the Arrowhead framework before using ah_system_adapter. Please consult the Arrowhead core repository for detailed documentation with special focus on the Service Registry, Authorization and Orchestrator core systems and their public client services.

Specification

  • Implements Arrowhead client functionalities
    • Client-side implementation of mandatory core services
    • Supported Arrowhead version: 4.4.0
  • Supported core interfaces
    • Service Registry interface
      • echo
      • register
      • unregister
      • query
    • Authorization interface
      • echo
      • get public key
    • Orchestrator interface
      • echo
      • request orchestration
      • start store orchestration by id
    • Target users:
      • software developers responsible for creating Arrowhead-compliant application systems and services

Warning

This library currently only supports unsecured HTTP connection, so Arrowhead Systems must be configured that way.

Initialization

The library must be initialized by instantiating a ArrowheadSystemAdapter struct using ArrowheadSystemAdapter::new() method.

The method requires the following parameters:

  • service_registry_address: &str - the base URL of the Service Registry core system,
  • authorization_address: &str - the base URL of the Authorization core system,
  • orchestrator_address: &str - the base URL of the Orchestrator core system,
  • client_system: ArrowheadSystem<NoEntryTag> - the specification of the client system, which will be adapted to the Arrowhead local cloud.

Interface description

The interface struct ArrowheadSystemAdapter has the following public functions:

The library performs blocking network calls. Each interface function returns a Result<T, Error> enum (referenced as Result<T> from this on) where T (a template parameter) is the return type of the different functions. The error enum Error has the following variants:

Variant Meaning
Error::HttpError(String) An HTTP-related error occured when trying to send request
Error::ArrowheadError(ArrowheadServerException) The the request to the Arrowhead Service returned with an Arrowhead-specific client error

echo_service_registry


Signature

fn echo_service_registry() -> Result<()>

Description

The echo_service_registry function tests connection to the Service Registry by using its Echo interface.

query_service


Signature

fn query_service(service_query_form: &ServiceQueryForm) -> Result<ServiceQueryList>

Description

The query_service function queries the Service Registry for the presence of the indicated service.

Notes

Direct lookups from Application Systems within the network is not advised in Arrowhead generation 4.4.0, due to security reasons.

register_service


Signature

fn register_service(register_service_input: RegisterServiceInput) - Result<ArrowheadService<EntryTag>>

Description

The register_service function registers an application service to the Service Registry.

unregister_service


Signature

fn unregister_service(service_definition: &str) -> Result<()>

Description

The unregister_service function deregisters from the Service Registry the application service defined by the service_definition input argument.

echo_authorization


Signature

fn echo_authorization_system() -> Result<()>

Description

The echo_authorization_system function tests connection to the Authorization System by using its Echo interface.

get_public_key


Signature

fn get_public_key() -> Result<String>

Description

The get_public_key function returns the public key of the Authorization System as a base64 encoded string.

Notes

Only applicable with SSL enabled.

echo_orchestrator


Signature

fn echo_orchestrator() -> Result<()>

Description

The echo_orchestrator function tests connection to the Orchestrator by using its Echo interface.

request_orchestration


Signature

fn request_orchestration(request_orchestration_input: RequestOrchestrationInput) -> Result<OrchestrationResponse>

Description

The request_orchestration function requests service orchestration from the Orchestrator.

Notes

The default orchestration-method is store-based orchestration. Dynamic orchestration request shall be specified by setting the overrideStore orchestration flag in the RequestOrchestrationInput. See the Arrowhead core documentation for further details.

request_orchestration_by_id


Signature

fn request_orchestration_by_id(id: i64) -> Result<OrchestrationResponse>

Description

The request_orchestration_by_id function requests service orchestration from the Orchestrator using the store entry id of the requester system.

Data Types

The data structs implemented by the library are specified by the requested Arrowhead core services. The definition of the input forms and output responses can be found in the Arrowhead core documentation. The Class Diagram of the library is presented in Figure 1:

ah_system_adapter Class Diagram Figure 1 - ah_system_adapter Data Types Class Diagram

ah_adapter_app

ah_adapter_app is a Cargo package containing a binary crate with the same name.

It provides an easy-to-use command line interface for:

  • service registration/deregistration
  • public key request for the system
  • orchestration request

User manual

Please follow this link for the User manual.

Developer manual

Please follow this link for the Developer manual.

About

Arrowhead client adapter written in rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published