Crate hermit_api

Crate hermit_api 

Expand description

Hermit daemon interface API.

This crate defines the API used to interact with the Hermit daemon.

§Features

  • client: enables the client API.
  • server: enables the server API (used by the Hermit daemon).

§Design

The Hermit daemon exposes a [tarpc] based RPC interface (see Hermit) and a read-only event stream (see Event).

§Modules

The api is split into several modules:

  • net - Network API provided by [hermit-net].
  • nxp - NXP API provided by [hermit-nxp].
  • position - Position API provided by [hermit-position].
  • power - Power manager API provided by [hermit-power].
  • sm - Service manager API provided by [hermit-sm].
  • time - Time manager API provided by [hermit-time].

§Compatibility

Hermit uses bincode as the serialization format, which unfortunately is not backwards-compatible :

  • Any change to existing types will break compatibility.
  • New methods must be added after ALL the trait pre-existing methods.

Making such a change is still possible without affecting binaries compiled with an older version. Every endpoint in the API is versioned with a suffix, e.g. identity_v1. When a breaking change in a type is made, a new endpoint is added with a new suffix, e.g. identity_v2 that returns this new type. The old endpoint is kept for compatibility, but only enabled by the “compat” feature. The old endpoint must still return the old type, so we need to essentially duplicate the type. Legacy versions of a type should add the version suffix to the type name.

Hermitd enables this feature and will continue serving the old endpoint, but clients should be updated to use the new endpoint.

Example:

#[tarpc::service]
trait Hermit {
    #[deprecated(since = "x.y.z")]
    async fn version_v1() -> VersionV1;
    async fn version_v2() -> Version;
}

// old version
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct VersionV1 {
    version: String,
}

// the current version
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct Version {
    version: String,
    build: String,
}

Re-exports§

pub use tarpc;

Modules§

clientclient
Client.
client_or_server 🔒 client or server
interface 🔒
mount
hermit-mount api.
net
hermit-net api.
nxp
hermit-nxp api.
position
hermit-position api.
power
hermit-power api.
serverserver
sm
hermit-sm api.
time
hermit-time api.

Structs§

HermitClient
The client stub that makes RPC calls to the server. All request methods return Futures.
Identity
Identity of the TCU.
ImageVersion
TCU image version information.
Status
Status of the Hermit daemon.
StatusV1
Status of the Hermit daemon.
Version
Version of the TCU.

Enums§

Event
Event emitted by the Hermit daemon.
HermitRequest
The request sent over the wire from the client to the server.
HermitResponse
The response sent over the wire from the server to the client.
MetaEvent
Meta event.

Traits§

Hermit
Hermit daemon interface.