#actor #wasmcloud #random #uuid #extra #api-bindings #capability-provider

wasmcloud-actor-extras

Interface to the extras contract for use by wasmCloud Actors

4 releases

0.1.3 Aug 11, 2021
0.1.2 Apr 16, 2021
0.1.1 Feb 17, 2021
0.1.0 Feb 10, 2021

#1358 in WebAssembly

Download history 48/week @ 2023-12-17 30/week @ 2023-12-24 16/week @ 2023-12-31 57/week @ 2024-01-07 46/week @ 2024-01-14 27/week @ 2024-01-21 23/week @ 2024-01-28 7/week @ 2024-02-04 35/week @ 2024-02-11 26/week @ 2024-02-18 59/week @ 2024-02-25 35/week @ 2024-03-03 98/week @ 2024-03-10 114/week @ 2024-03-17 59/week @ 2024-03-24 153/week @ 2024-03-31

427 downloads per month
Used in 2 crates

Apache-2.0

11KB
117 lines

crates.io  Rust license  documentation

wasmCloud Extras Actor Interface

This crate provides wasmCloud actors with an interface to the extras capability provider. Every wasmCloud host runtime automatically comes with a built-in extras provider. However, actors using this provider will still need to be signed with the wasmcloud:extras capability contract ID.

The following functions are supported on the extras Host interface:

Example:

extern crate wapc_guest as guest;
use guest::prelude::*;
use wasmcloud_actor_core as actor;
use wasmcloud_actor_extras as extras;
use wasmcloud_actor_http_server as http;
use serde_json::json;
use log::{error, info};

#[actor::init]
pub fn init() {
    http::Handlers::register_handle_request(generate_guid);
}

/// Generate a Guid and return it in a JSON envelope
fn generate_guid(_req: http::Request) -> HandlerResult<http::Response> {
  let guid = get_guid()?      // Replace this with `extras::default().request_guid()?`
                .unwrap_or("unknown-guid".to_string());

  let result = json!({"guid": guid });
  Ok(http::Response::json(&result, 200, "OK"))

}

Dependencies

~0.8–1.5MB
~32K SLoC