Crates.io | wasmcloud-interface-lattice-control |
lib.rs | wasmcloud-interface-lattice-control |
version | 0.20.0 |
source | src |
created_at | 2021-11-08 20:03:54.832914 |
updated_at | 2023-09-19 21:40:14.34469 |
description | This library contains types and service definitions used by actors and providers to support the wasmcloud:latticecontrol contract |
homepage | https://wasmcloud.com |
repository | https://github.com/wasmCloud/interfaces |
max_upload_size | |
id | 478615 |
size | 185,288 |
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.
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 |
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)
}