Crate wasmcloud_actor_core[−][src]
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
CapabilityConfiguration | |
Handlers | Used to register core message handlers |
HealthCheckRequest | A request sent to the actor by the host itself in order to determine health status |
HealthCheckResponse | All actors must return a health check response to the host upon
receipt of a health request. Returning in |
Functions
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. |