#webassembly #wasm #wasmcloud #control #ctl

wasmcloud-interface-lattice-control

This library contains types and service definitions used by actors and providers to support the wasmcloud:latticecontrol contract

24 releases (15 breaking)

0.17.0 Dec 29, 2022
0.16.1 Nov 23, 2022
0.15.0 Sep 21, 2022
0.12.2 Jul 18, 2022
0.2.2 Nov 26, 2021

#545 in WebAssembly

Download history 23/week @ 2022-11-26 7/week @ 2022-12-03 1/week @ 2022-12-10 27/week @ 2022-12-17 46/week @ 2022-12-24 39/week @ 2022-12-31 22/week @ 2023-01-07 16/week @ 2023-01-14 40/week @ 2023-01-21 45/week @ 2023-01-28 125/week @ 2023-02-04 85/week @ 2023-02-11 52/week @ 2023-02-18 61/week @ 2023-02-25 1/week @ 2023-03-04 3/week @ 2023-03-11

177 downloads per month

Apache-2.0 and maybe LGPL-3.0-or-later

185KB
4.5K SLoC

crates.io 

wasmCloud Lattice Control Interface

The lattice control interface is a smithy-defined interface contract that outlines the operations and data structures supported by a capability provider supporting the wasmcloud:latticecontrol contract.

  • Capability Providers - Capability providers can simply provide a wrapper around a NATS client, exposing lattice control functionality to actors
  • Actors - Actors can make use of this crate as they would any other wasmCloud interface crate, thus enabling an actor to contain business logic that manipulates a lattice.

Capability Provider Implementations

The following is a list of implementations of the wasmcloud:latticecontrol contract. Feel free to submit a PR adding your implementation if you have a community/open source version.

Name Vendor Description
Lattice Controller wasmCloud First party implementation of the lattice controller provider

Example Usage (🦀 Rust)

Start 250 instances of the echo actor actor on a host

use wasmbus_rpc::actor::prelude::{Context, RpcResult};
use wasmcloud_interface_lattice_control::{
    CtlOperationAck, LatticeController, LatticeControllerSender, StartActorCommand,
};
use wasmcloud_interface_logging::debug;

async fn start_actor(ctx: &Context) -> RpcResult<CtlOperationAck> {
    let lattice = LatticeControllerSender::new();
    let cmd = StartActorCommand {
        lattice_id: "default".to_string(),
        actor_ref: "wasmcloud.azurecr.io/echo:0.3.4".to_string(),
        annotations: None,
        count: 250,
        host_id: "NB67YNOVU5YB3526RUNCKNZBCQDH2L5NZJKQ6FWOVWGSHNHHEO65RP4A".to_string(),
    };

    debug!(
        "Starting {} instance(s) of actor {} on host {}",
        cmd.count, cmd.actor_ref, cmd.host_id
    );

    lattice.start_actor(ctx, &cmd).await
}

Get all hosts in a lattice

use wasmbus_rpc::actor::prelude::{Context, RpcResult};
use wasmcloud_interface_lattice_control::{Host, LatticeController, LatticeControllerSender};
use wasmcloud_interface_logging::info;

async fn get_hosts(ctx: &Context) -> RpcResult<Vec<Host>> {
    let lattice = LatticeControllerSender::new();
    let hosts = lattice.get_hosts(ctx, GetHostsRequest {
        lattice_id: "default".to_string()
    }).await?;

    info!("There are {} hosts in this lattice", hosts.len());
    Ok(hosts)
}

Dependencies

~9–20MB
~407K SLoC