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§
- client
client - Client.
- client_
or_ 🔒server clientorserver - interface 🔒
- mount
hermit-mountapi.- net
hermit-netapi.- nxp
hermit-nxpapi.- position
hermit-positionapi.- power
hermit-powerapi.- server
server - sm
hermit-smapi.- time
hermit-timeapi.
Structs§
- Hermit
Client - The client stub that makes RPC calls to the server. All request methods return Futures.
- Identity
- Identity of the TCU.
- Image
Version - TCU image version information.
- Status
- Status of the Hermit daemon.
- Status
V1 - Status of the Hermit daemon.
- Version
- Version of the TCU.
Enums§
- Event
- Event emitted by the Hermit daemon.
- Hermit
Request - The request sent over the wire from the client to the server.
- Hermit
Response - The response sent over the wire from the server to the client.
- Meta
Event - Meta event.
Traits§
- Hermit
- Hermit daemon interface.