Expand description
§Core wasmCloud Actor Interface
This crate contains the data types required by all actors, namely the health check request and health check response, and CapabilityConfiguration, a struct used by capability providers to receive link data for an actor.
If you use the init
macro, then a default health check handler will be created for you, as shown in
this example. If you want to provide your own custom health check handler, then simply call
Handlers::register_health_check
with your handler function.
§Example
extern crate wasmcloud_actor_core as actor;
#[actor::init]
pub fn init() {
// register handlers here
}
§Caveat
Your init
function is called by the wasmcloud host runtime when the actor is first loaded into the host. This function
is only ever called once, and is called before any provider linking takes place. In other words, code written inside this
function cannot communicate with capability providers.
Also, in keeping with the notion of stateless actors, avoid using this function to initialize or create global state.
Structs§
- Capability
Configuration - Represents the data sent to a capability provider at link time
- Handlers
- Health
Check Request - A request sent to the actor by the host in order to determine health status
- Health
Check Response - All actors must return a health check response to the host upon receipt of a
health request. Returning in
Err
indicates total actor failure, while returning a valid response with thehealthy
flag set to false indicates that the actor has somehow detected that it cannot perform its given task
Functions§
- call_
actor - Performs an actor-to-actor call, with the target actor identified by a reference string. This reference can be an OCI image URL, a 56-character public key (subject), or, if one is defined, a developer-friendly call alias
- deserialize
- The standard function for de-serializing codec structs from a format suitable for message exchange between actor and host. Use of any other function to deserialize could result in breaking incompatibilities.
- serialize
- The standard function for serializing codec structs into a format that can be used for message exchange between actor and host. Use of any other function to serialize could result in breaking incompatibilities.
Attribute Macros§
- init
- Marks the actor entry-point function to be executed by wasmcloud