From cd6580dc7505c7aa25cf3fa066a0c0fb112019b7 Mon Sep 17 00:00:00 2001 From: stevelr Date: Wed, 6 Jul 2022 12:14:54 -0700 Subject: [PATCH] Update/async nats (#79) * async-nats Signed-off-by: stevelr * bump all interfaces patch semver for wasmbus-rpc async-nats Signed-off-by: stevelr * fix crate reference Signed-off-by: stevelr * async-nats updates Signed-off-by: stevelr * bump git rev Signed-off-by: stevelr * change structured_logging_enabled to structured_logging Signed-off-by: stevelr * async-nats: latest wasmbus-rpc Signed-off-by: stevelr * update dependencies Signed-off-by: stevelr * update async dependency Signed-off-by: stevelr * update wasmbus-rpc dep Signed-off-by: stevelr * pinned versions to wasmbus-0.9 and codegen-0.4.6 Signed-off-by: Brooks Townsend Co-authored-by: Brooks Townsend --- Cargo.toml | 1 + Makefile | 2 +- blobstore/rust/Cargo.toml | 6 +- blobstore/rust/src/blobstore.rs | 109 ++++++++++++++---- core/wasmcloud-core.smithy | 5 +- factorial/rust/Cargo.toml | 8 +- factorial/rust/src/factorial.rs | 7 +- httpclient/codegen.toml | 3 +- httpclient/rust/Cargo.toml | 6 +- httpclient/rust/src/httpclient.rs | 27 ++++- httpserver/rust/Cargo.toml | 6 +- httpserver/rust/src/httpserver.rs | 27 ++++- keyvalue/codegen.toml | 3 +- keyvalue/rust/Cargo.toml | 6 +- keyvalue/rust/src/keyvalue.rs | 93 +++++++++++++-- .../lattice-control-interface.smithy | 2 +- lattice-control/rust/Cargo.toml | 7 +- lattice-control/rust/src/control.rs | 4 +- logging/rust/Cargo.toml | 6 +- logging/rust/src/logging.rs | 11 +- messaging/rust/Cargo.toml | 6 +- messaging/rust/src/messaging.rs | 31 ++++- ml/rust/Cargo.toml | 7 +- ml/rust/src/mlinference.rs | 18 ++- numbergen/rust/Cargo.toml | 6 +- numbergen/rust/src/numbergen.rs | 14 ++- sqldb/rust/Cargo.toml | 9 +- sqldb/rust/src/sqldb.rs | 50 ++++++-- testing/rust/Cargo.toml | 6 +- testing/rust/src/testing.rs | 44 +++++-- tests/actor/builtins/Cargo.toml | 10 +- 31 files changed, 414 insertions(+), 126 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8fef9ff..e851391 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "keyvalue/rust", "logging/rust", "messaging/rust", + "ml/rust", "numbergen/rust", "sqldb/rust", "lattice-control/rust", diff --git a/Makefile b/Makefile index cc923cb..3cb1450 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ project_dir = $(abspath $(shell pwd)) # Reminder: when adding a subdir below don't forget to update # Cargo.toml (if it's a rust project), and codegen.toml (if there are smithy files) subdirs = blobstore core factorial httpclient httpserver \ - keyvalue lattice-control logging messaging numbergen sqldb testing + keyvalue lattice-control logging messaging ml numbergen sqldb testing include build/makefiles/interface.mk diff --git a/blobstore/rust/Cargo.toml b/blobstore/rust/Cargo.toml index 60d7206..6f8ca4a 100644 --- a/blobstore/rust/Cargo.toml +++ b/blobstore/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-blobstore" -version = "0.2.0" +version = "0.3.0" description = "interface for accessing an object store" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -25,12 +25,12 @@ futures = "0.3" serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.2" +weld-codegen = "0.4.6" diff --git a/blobstore/rust/src/blobstore.rs b/blobstore/rust/src/blobstore.rs index b4bdd6e..20b08bf 100644 --- a/blobstore/rust/src/blobstore.rs +++ b/blobstore/rust/src/blobstore.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.blobstore #[allow(unused_imports)] use async_trait::async_trait; @@ -48,7 +50,10 @@ pub struct Chunk { pub fn encode_chunk( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &Chunk, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(5)?; encode_object_id(e, &val.object_id)?; encode_container_id(e, &val.container_id)?; @@ -189,7 +194,10 @@ pub struct ChunkResponse { pub fn encode_chunk_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ChunkResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(1)?; e.bool(val.cancel_download)?; Ok(()) @@ -250,7 +258,10 @@ pub type ContainerId = String; pub fn encode_container_id( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ContainerId, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.str(val)?; Ok(()) } @@ -272,7 +283,10 @@ pub type ContainerIds = Vec; pub fn encode_container_ids( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ContainerIds, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_container_id(e, item)?; @@ -335,7 +349,10 @@ pub struct ContainerMetadata { pub fn encode_container_metadata( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ContainerMetadata, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; encode_container_id(e, &val.container_id)?; if let Some(val) = val.created_at.as_ref() { @@ -447,7 +464,10 @@ pub struct ContainerObject { pub fn encode_container_object( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ContainerObject, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; encode_container_id(e, &val.container_id)?; encode_object_id(e, &val.object_id)?; @@ -548,7 +568,10 @@ pub type ContainersInfo = Vec; pub fn encode_containers_info( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ContainersInfo, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_container_metadata(e, item)?; @@ -623,7 +646,10 @@ pub struct GetObjectRequest { pub fn encode_get_object_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &GetObjectRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(4)?; encode_object_id(e, &val.object_id)?; encode_container_id(e, &val.container_id)?; @@ -797,7 +823,10 @@ pub struct GetObjectResponse { pub fn encode_get_object_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &GetObjectResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(6)?; e.bool(val.success)?; if let Some(val) = val.error.as_ref() { @@ -977,7 +1006,10 @@ pub struct ItemResult { pub fn encode_item_result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ItemResult, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.key)?; e.bool(val.success)?; @@ -1105,7 +1137,10 @@ pub struct ListObjectsRequest { pub fn encode_list_objects_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ListObjectsRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(6)?; e.str(&val.container_id)?; if let Some(val) = val.start_with.as_ref() { @@ -1300,7 +1335,10 @@ pub struct ListObjectsResponse { pub fn encode_list_objects_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ListObjectsResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; encode_objects_info(e, &val.objects)?; e.bool(val.is_last)?; @@ -1411,7 +1449,10 @@ pub type MultiResult = Vec; pub fn encode_multi_result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &MultiResult, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_item_result(e, item)?; @@ -1465,7 +1506,10 @@ pub type ObjectId = String; pub fn encode_object_id( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ObjectId, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.str(val)?; Ok(()) } @@ -1485,7 +1529,10 @@ pub type ObjectIds = Vec; pub fn encode_object_ids( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ObjectIds, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_object_id(e, item)?; @@ -1570,7 +1617,10 @@ pub struct ObjectMetadata { pub fn encode_object_metadata( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ObjectMetadata, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(6)?; encode_object_id(e, &val.object_id)?; encode_container_id(e, &val.container_id)?; @@ -1760,7 +1810,10 @@ pub type ObjectsInfo = Vec; pub fn encode_objects_info( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ObjectsInfo, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_object_metadata(e, item)?; @@ -1828,7 +1881,10 @@ pub struct PutChunkRequest { pub fn encode_put_chunk_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &PutChunkRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; encode_chunk(e, &val.chunk)?; if let Some(val) = val.stream_id.as_ref() { @@ -1948,7 +2004,10 @@ pub struct PutObjectRequest { pub fn encode_put_object_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &PutObjectRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; encode_chunk(e, &val.chunk)?; if let Some(val) = val.content_type.as_ref() { @@ -2071,7 +2130,10 @@ pub struct PutObjectResponse { pub fn encode_put_object_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &PutObjectResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(1)?; if let Some(val) = val.stream_id.as_ref() { e.str(val)?; @@ -2152,7 +2214,10 @@ pub struct RemoveObjectsRequest { pub fn encode_remove_objects_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &RemoveObjectsRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; encode_container_id(e, &val.container_id)?; encode_object_ids(e, &val.objects)?; diff --git a/core/wasmcloud-core.smithy b/core/wasmcloud-core.smithy index 1428ab6..5fae01b 100644 --- a/core/wasmcloud-core.smithy +++ b/core/wasmcloud-core.smithy @@ -176,9 +176,10 @@ structure HostData { @n(13) defaultRpcTimeoutMs: U64, - @serialization(name: "structured_logging_enabled") + /// True if structured logging is enabled for the host. Providers should use the same setting as the host. + @serialization(name: "structured_logging") @n(14) - structuredLoggingEnabled: Boolean, + structuredLogging: Boolean, } list ClusterIssuers { diff --git a/factorial/rust/Cargo.toml b/factorial/rust/Cargo.toml index 99c906c..065fe88 100644 --- a/factorial/rust/Cargo.toml +++ b/factorial/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-factorial" -version = "0.4.1" +version = "0.5.0" description = "Interface library for the wasmcloud factorial capability, wasmcloud:example:factorial" homepage = "https://wasmcloud.dev" repository = "https://github.com/wasmcloud/interfaces" @@ -20,15 +20,15 @@ default = [] [dependencies] async-trait = "0.1" futures = "0.3" -serde = { version = "1.0" , features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/factorial/rust/src/factorial.rs b/factorial/rust/src/factorial.rs index 6c418c6..2be90c7 100644 --- a/factorial/rust/src/factorial.rs +++ b/factorial/rust/src/factorial.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.factorial #[allow(unused_imports)] use async_trait::async_trait; @@ -50,8 +52,10 @@ pub trait FactorialReceiver: MessageDispatch + Factorial { "Calculate" => { let value: u32 = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'U32': {}", e)))?; + let resp = Factorial::calculate(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "Factorial.Calculate", arg: Cow::Owned(buf), @@ -135,6 +139,7 @@ impl Factorial for Factori /// Calculates the factorial (n!) of the input parameter async fn calculate(&self, ctx: &Context, arg: &u32) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/httpclient/codegen.toml b/httpclient/codegen.toml index 0fe7f1b..6bcb5b8 100644 --- a/httpclient/codegen.toml +++ b/httpclient/codegen.toml @@ -12,7 +12,8 @@ path = "httpclient.smithy" [[models]] -url = "https://cdn.jsdelivr.net/gh/wasmcloud/interfaces/core" +#url = "https://cdn.jsdelivr.net/gh/wasmcloud/interfaces/core" +path = "../core" files = [ "wasmcloud-core.smithy", "wasmcloud-model.smithy" ] diff --git a/httpclient/rust/Cargo.toml b/httpclient/rust/Cargo.toml index a347790..0569e13 100644 --- a/httpclient/rust/Cargo.toml +++ b/httpclient/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-httpclient" -version = "0.5.0" +version = "0.6.0" description = "interface for actors to issue http/https requests (wasmcloud:httpclient)" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -25,12 +25,12 @@ futures = "0.3" serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/httpclient/rust/src/httpclient.rs b/httpclient/rust/src/httpclient.rs index 456e593..e565b23 100644 --- a/httpclient/rust/src/httpclient.rs +++ b/httpclient/rust/src/httpclient.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.httpclient #[allow(unused_imports)] use async_trait::async_trait; @@ -30,7 +32,10 @@ pub type HeaderMap = std::collections::HashMap; pub fn encode_header_map( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HeaderMap, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.map(val.len() as u64)?; for (k, v) in val { e.str(k)?; @@ -70,7 +75,10 @@ pub type HeaderValues = Vec; pub fn encode_header_values( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HeaderValues, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.str(item)?; @@ -127,7 +135,10 @@ pub struct HttpRequest { pub fn encode_http_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HttpRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(4)?; e.str(&val.method)?; e.str(&val.url)?; @@ -258,7 +269,10 @@ pub struct HttpResponse { pub fn encode_http_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HttpResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.u16(val.status_code)?; encode_header_map(e, &val.header)?; @@ -379,8 +393,10 @@ pub trait HttpClientReceiver: MessageDispatch + HttpClient { "Request" => { let value: HttpRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'HttpRequest': {}", e)))?; + let resp = HttpClient::request(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "HttpClient.Request", arg: Cow::Owned(buf), @@ -440,6 +456,7 @@ impl HttpClient for HttpCl /// Issue outgoing http request async fn request(&self, ctx: &Context, arg: &HttpRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/httpserver/rust/Cargo.toml b/httpserver/rust/Cargo.toml index 50df333..04d6a97 100644 --- a/httpserver/rust/Cargo.toml +++ b/httpserver/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-httpserver" -version = "0.5.0" +version = "0.6.0" description = "interface for actors to receive http requests (wasmcloud:httpserver)" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -22,11 +22,11 @@ async-trait = "0.1" serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # dependencies for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/httpserver/rust/src/httpserver.rs b/httpserver/rust/src/httpserver.rs index ec00c8f..a333822 100644 --- a/httpserver/rust/src/httpserver.rs +++ b/httpserver/rust/src/httpserver.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.httpserver #[allow(unused_imports)] use async_trait::async_trait; @@ -30,7 +32,10 @@ pub type HeaderMap = std::collections::HashMap; pub fn encode_header_map( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HeaderMap, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.map(val.len() as u64)?; for (k, v) in val { e.str(k)?; @@ -70,7 +75,10 @@ pub type HeaderValues = Vec; pub fn encode_header_values( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HeaderValues, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.str(item)?; @@ -132,7 +140,10 @@ pub struct HttpRequest { pub fn encode_http_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HttpRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(5)?; e.str(&val.method)?; e.str(&val.path)?; @@ -268,7 +279,10 @@ pub struct HttpResponse { pub fn encode_http_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &HttpResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.u16(val.status_code)?; encode_header_map(e, &val.header)?; @@ -384,8 +398,10 @@ pub trait HttpServerReceiver: MessageDispatch + HttpServer { "HandleRequest" => { let value: HttpRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'HttpRequest': {}", e)))?; + let resp = HttpServer::handle_request(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "HttpServer.HandleRequest", arg: Cow::Owned(buf), @@ -443,6 +459,7 @@ impl HttpServer for HttpSe #[allow(unused)] async fn handle_request(&self, ctx: &Context, arg: &HttpRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/keyvalue/codegen.toml b/keyvalue/codegen.toml index 78006f7..8e8acaf 100644 --- a/keyvalue/codegen.toml +++ b/keyvalue/codegen.toml @@ -6,7 +6,8 @@ path = "." files = [ "keyvalue.smithy" ] [[models]] -url = "https://cdn.jsdelivr.net/gh/wasmcloud/interfaces/core" +#url = "https://cdn.jsdelivr.net/gh/wasmcloud/interfaces/core" +path = "../core" files = [ "wasmcloud-core.smithy", "wasmcloud-model.smithy" ] ## diff --git a/keyvalue/rust/Cargo.toml b/keyvalue/rust/Cargo.toml index 2a319b6..549f66f 100644 --- a/keyvalue/rust/Cargo.toml +++ b/keyvalue/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-keyvalue" -version = "0.6.0" +version = "0.7.0" description = "Key-Value store (wasmcloud:keyvalue)" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -23,11 +23,11 @@ serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" log = "0.4" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/keyvalue/rust/src/keyvalue.rs b/keyvalue/rust/src/keyvalue.rs index b6ccc77..a59a988 100644 --- a/keyvalue/rust/src/keyvalue.rs +++ b/keyvalue/rust/src/keyvalue.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.keyvalue #[allow(unused_imports)] use async_trait::async_trait; @@ -37,7 +39,10 @@ pub struct GetResponse { pub fn encode_get_response( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &GetResponse, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.value)?; e.bool(val.exists)?; @@ -117,7 +122,10 @@ pub struct IncrementRequest { pub fn encode_increment_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &IncrementRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.key)?; e.i32(val.value)?; @@ -199,7 +207,10 @@ pub struct ListAddRequest { pub fn encode_list_add_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ListAddRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.list_name)?; e.str(&val.value)?; @@ -282,7 +293,10 @@ pub struct ListDelRequest { pub fn encode_list_del_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ListDelRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.list_name)?; e.str(&val.value)?; @@ -366,7 +380,10 @@ pub struct ListRangeRequest { pub fn encode_list_range_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ListRangeRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.list_name)?; e.i32(val.start)?; @@ -459,7 +476,10 @@ pub struct SetAddRequest { pub fn encode_set_add_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &SetAddRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.set_name)?; e.str(&val.value)?; @@ -538,7 +558,10 @@ pub struct SetDelRequest { pub fn encode_set_del_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &SetDelRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.set_name)?; e.str(&val.value)?; @@ -621,7 +644,10 @@ pub struct SetRequest { pub fn encode_set_request( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &SetRequest, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.key)?; e.str(&val.value)?; @@ -704,7 +730,10 @@ pub type StringList = Vec; pub fn encode_string_list( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &StringList, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.str(item)?; @@ -831,8 +860,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "Increment" => { let value: IncrementRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'IncrementRequest': {}", e)))?; + let resp = KeyValue::increment(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.Increment", arg: Cow::Owned(buf), @@ -841,8 +872,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "Contains" => { let value: String = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'String': {}", e)))?; + let resp = KeyValue::contains(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.Contains", arg: Cow::Owned(buf), @@ -851,8 +884,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "Del" => { let value: String = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'String': {}", e)))?; + let resp = KeyValue::del(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.Del", arg: Cow::Owned(buf), @@ -861,8 +896,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "Get" => { let value: String = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'String': {}", e)))?; + let resp = KeyValue::get(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.Get", arg: Cow::Owned(buf), @@ -871,8 +908,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "ListAdd" => { let value: ListAddRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'ListAddRequest': {}", e)))?; + let resp = KeyValue::list_add(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.ListAdd", arg: Cow::Owned(buf), @@ -881,8 +920,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "ListClear" => { let value: String = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'String': {}", e)))?; + let resp = KeyValue::list_clear(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.ListClear", arg: Cow::Owned(buf), @@ -891,8 +932,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "ListDel" => { let value: ListDelRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'ListDelRequest': {}", e)))?; + let resp = KeyValue::list_del(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.ListDel", arg: Cow::Owned(buf), @@ -901,8 +944,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "ListRange" => { let value: ListRangeRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'ListRangeRequest': {}", e)))?; + let resp = KeyValue::list_range(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.ListRange", arg: Cow::Owned(buf), @@ -911,6 +956,7 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "Set" => { let value: SetRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'SetRequest': {}", e)))?; + let _resp = KeyValue::set(self, ctx, &value).await?; let buf = Vec::new(); Ok(Message { @@ -921,8 +967,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "SetAdd" => { let value: SetAddRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'SetAddRequest': {}", e)))?; + let resp = KeyValue::set_add(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.SetAdd", arg: Cow::Owned(buf), @@ -931,8 +979,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "SetDel" => { let value: SetDelRequest = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'SetDelRequest': {}", e)))?; + let resp = KeyValue::set_del(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.SetDel", arg: Cow::Owned(buf), @@ -941,8 +991,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "SetIntersection" => { let value: StringList = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'StringList': {}", e)))?; + let resp = KeyValue::set_intersection(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.SetIntersection", arg: Cow::Owned(buf), @@ -951,8 +1003,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "SetQuery" => { let value: String = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'String': {}", e)))?; + let resp = KeyValue::set_query(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.SetQuery", arg: Cow::Owned(buf), @@ -961,8 +1015,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "SetUnion" => { let value: StringList = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'StringList': {}", e)))?; + let resp = KeyValue::set_union(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.SetUnion", arg: Cow::Owned(buf), @@ -971,8 +1027,10 @@ pub trait KeyValueReceiver: MessageDispatch + KeyValue { "SetClear" => { let value: String = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'String': {}", e)))?; + let resp = KeyValue::set_clear(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "KeyValue.SetClear", arg: Cow::Owned(buf), @@ -1029,6 +1087,7 @@ impl KeyValue for KeyValue /// Increments a numeric value, returning the new value async fn increment(&self, ctx: &Context, arg: &IncrementRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1053,6 +1112,7 @@ impl KeyValue for KeyValue arg: &TS, ) -> RpcResult { let buf = wasmbus_rpc::common::serialize(&arg.to_string())?; + let resp = self .transport .send( @@ -1077,6 +1137,7 @@ impl KeyValue for KeyValue arg: &TS, ) -> RpcResult { let buf = wasmbus_rpc::common::serialize(&arg.to_string())?; + let resp = self .transport .send( @@ -1103,6 +1164,7 @@ impl KeyValue for KeyValue arg: &TS, ) -> RpcResult { let buf = wasmbus_rpc::common::serialize(&arg.to_string())?; + let resp = self .transport .send( @@ -1123,6 +1185,7 @@ impl KeyValue for KeyValue /// Append a value onto the end of a list. Returns the new list size async fn list_add(&self, ctx: &Context, arg: &ListAddRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1149,6 +1212,7 @@ impl KeyValue for KeyValue arg: &TS, ) -> RpcResult { let buf = wasmbus_rpc::common::serialize(&arg.to_string())?; + let resp = self .transport .send( @@ -1169,6 +1233,7 @@ impl KeyValue for KeyValue /// Deletes a value from a list. Returns true if the item was removed. async fn list_del(&self, ctx: &Context, arg: &ListDelRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1192,6 +1257,7 @@ impl KeyValue for KeyValue /// is beyond the end of the list, it is treated as the end of the list. async fn list_range(&self, ctx: &Context, arg: &ListRangeRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1214,6 +1280,7 @@ impl KeyValue for KeyValue /// or 0 for no expiration. async fn set(&self, ctx: &Context, arg: &SetRequest) -> RpcResult<()> { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1231,6 +1298,7 @@ impl KeyValue for KeyValue /// Add an item into a set. Returns number of items added (1 or 0) async fn set_add(&self, ctx: &Context, arg: &SetAddRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1251,6 +1319,7 @@ impl KeyValue for KeyValue /// Deletes an item from the set. Returns number of items removed from the set (1 or 0) async fn set_del(&self, ctx: &Context, arg: &SetDelRequest) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1273,6 +1342,7 @@ impl KeyValue for KeyValue /// output: values async fn set_intersection(&self, ctx: &Context, arg: &StringList) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1299,6 +1369,7 @@ impl KeyValue for KeyValue arg: &TS, ) -> RpcResult { let buf = wasmbus_rpc::common::serialize(&arg.to_string())?; + let resp = self .transport .send( @@ -1321,6 +1392,7 @@ impl KeyValue for KeyValue /// output: union of values async fn set_union(&self, ctx: &Context, arg: &StringList) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -1347,6 +1419,7 @@ impl KeyValue for KeyValue arg: &TS, ) -> RpcResult { let buf = wasmbus_rpc::common::serialize(&arg.to_string())?; + let resp = self .transport .send( diff --git a/lattice-control/lattice-control-interface.smithy b/lattice-control/lattice-control-interface.smithy index 4f190c5..9f7e323 100644 --- a/lattice-control/lattice-control-interface.smithy +++ b/lattice-control/lattice-control-interface.smithy @@ -7,7 +7,7 @@ metadata package = [ { namespace: "org.wasmcloud.lattice.control", - crate: "lattice-control-interface" + crate: "wasmcloud_interface_lattice_control" } ] diff --git a/lattice-control/rust/Cargo.toml b/lattice-control/rust/Cargo.toml index 7a711e9..afd4691 100644 --- a/lattice-control/rust/Cargo.toml +++ b/lattice-control/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-lattice-control" -version = "0.11.0" +version = "0.12.0" edition = "2021" homepage = "https://wasmcloud.dev" repository = "https://github.com/wasmCloud/interfaces" @@ -19,10 +19,9 @@ async-trait = "0.1" data-encoding = "2.3.1" futures = "0.3" log = "0.4.14" -#ring = "0.16.20" rmp-serde = "1.1.0" serde = { version = "1.0.118", features = ["derive"] } -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/lattice-control/rust/src/control.rs b/lattice-control/rust/src/control.rs index 2556753..d215dd6 100644 --- a/lattice-control/rust/src/control.rs +++ b/lattice-control/rust/src/control.rs @@ -1,4 +1,4 @@ -// This file is @generated by wasmcloud/weld-codegen 0.4.5. +// This file is @generated by wasmcloud/weld-codegen 0.4.6. // It is not intended for manual editing. // namespace: org.wasmcloud.lattice.control @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; use std::{borrow::Borrow, borrow::Cow, io::Write, string::ToString}; #[allow(unused_imports)] use wasmbus_rpc::{ - //cbor::*, + cbor::*, common::{ deserialize, message_format, serialize, Context, Message, MessageDispatch, MessageFormat, SendOpts, Transport, diff --git a/logging/rust/Cargo.toml b/logging/rust/Cargo.toml index 6834c5c..0313606 100644 --- a/logging/rust/Cargo.toml +++ b/logging/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-logging" -version = "0.5.0" +version = "0.6.0" description = "interface for logging capability provider (wasmcloud:builtin:logging)" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -26,11 +26,11 @@ serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" cfg-if = "1.0" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/logging/rust/src/logging.rs b/logging/rust/src/logging.rs index e48f93d..0fb3cc4 100644 --- a/logging/rust/src/logging.rs +++ b/logging/rust/src/logging.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.logging #[allow(unused_imports)] use async_trait::async_trait; @@ -36,7 +38,10 @@ pub struct LogEntry { pub fn encode_log_entry( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &LogEntry, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.level)?; e.str(&val.text)?; @@ -125,6 +130,7 @@ pub trait LoggingReceiver: MessageDispatch + Logging { "WriteLog" => { let value: LogEntry = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'LogEntry': {}", e)))?; + let _resp = Logging::write_log(self, ctx, &value).await?; let buf = Vec::new(); Ok(Message { @@ -189,6 +195,7 @@ impl Logging for LoggingSe /// async fn write_log(&self, ctx: &Context, arg: &LogEntry) -> RpcResult<()> { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/messaging/rust/Cargo.toml b/messaging/rust/Cargo.toml index 23960c2..0aa045b 100644 --- a/messaging/rust/Cargo.toml +++ b/messaging/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-messaging" -version = "0.5.0" +version = "0.6.0" description = "Interface library for the wasmCloud messaging capability, wasmcloud:messaging" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -23,11 +23,11 @@ serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" log = "0.4" -wasmbus-rpc = "0.8.5" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/messaging/rust/src/messaging.rs b/messaging/rust/src/messaging.rs index cad5e71..0c3bff7 100644 --- a/messaging/rust/src/messaging.rs +++ b/messaging/rust/src/messaging.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.messaging #[allow(unused_imports)] use async_trait::async_trait; @@ -42,7 +44,10 @@ pub struct PubMessage { pub fn encode_pub_message( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &PubMessage, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.subject)?; if let Some(val) = val.reply_to.as_ref() { @@ -149,7 +154,10 @@ pub struct ReplyMessage { pub fn encode_reply_message( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ReplyMessage, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.subject)?; if let Some(val) = val.reply_to.as_ref() { @@ -258,7 +266,10 @@ pub struct RequestMessage { pub fn encode_request_message( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &RequestMessage, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.subject)?; e.bytes(&val.body)?; @@ -356,7 +367,10 @@ pub struct SubMessage { pub fn encode_sub_message( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &SubMessage, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.subject)?; if let Some(val) = val.reply_to.as_ref() { @@ -472,6 +486,7 @@ pub trait MessageSubscriberReceiver: MessageDispatch + MessageSubscriber { "HandleMessage" => { let value: SubMessage = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'SubMessage': {}", e)))?; + let _resp = MessageSubscriber::handle_message(self, ctx, &value).await?; let buf = Vec::new(); Ok(Message { @@ -536,6 +551,7 @@ impl MessageSubscriber /// subscription handler async fn handle_message(&self, ctx: &Context, arg: &SubMessage) -> RpcResult<()> { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -587,6 +603,7 @@ pub trait MessagingReceiver: MessageDispatch + Messaging { "Publish" => { let value: PubMessage = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'PubMessage': {}", e)))?; + let _resp = Messaging::publish(self, ctx, &value).await?; let buf = Vec::new(); Ok(Message { @@ -597,8 +614,10 @@ pub trait MessagingReceiver: MessageDispatch + Messaging { "Request" => { let value: RequestMessage = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'RequestMessage': {}", e)))?; + let resp = Messaging::request(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "Messaging.Request", arg: Cow::Owned(buf), @@ -661,6 +680,7 @@ impl Messaging for Messagi /// subject for the response. async fn publish(&self, ctx: &Context, arg: &PubMessage) -> RpcResult<()> { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -679,6 +699,7 @@ impl Messaging for Messagi /// waiting for a response. async fn request(&self, ctx: &Context, arg: &RequestMessage) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/ml/rust/Cargo.toml b/ml/rust/Cargo.toml index bd9f9b7..5d02730 100644 --- a/ml/rust/Cargo.toml +++ b/ml/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud_interface_mlinference" -version = "0.1.0" +version = "0.2.0" description = "Interface library for the MlInference capability" authors = [ "dev@example.com" ] edition = "2021" @@ -18,13 +18,12 @@ default = [] [dependencies] async-trait = "0.1" serde = { version = "1.0" , features = ["derive"] } -wasmbus-rpc = "0.8.5" serde_bytes = "0.11" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" - +weld-codegen = "0.4.6" diff --git a/ml/rust/src/mlinference.rs b/ml/rust/src/mlinference.rs index 9b8d5a0..51ea7f8 100644 --- a/ml/rust/src/mlinference.rs +++ b/ml/rust/src/mlinference.rs @@ -1,4 +1,4 @@ -// This file is @generated by wasmcloud/weld-codegen 0.4.4. +// This file is @generated by wasmcloud/weld-codegen 0.4.6. // It is not intended for manual editing. // namespace: org.wasmcloud.interface.mlinference @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; use std::{borrow::Borrow, borrow::Cow, io::Write, string::ToString}; #[allow(unused_imports)] use wasmbus_rpc::{ - //cbor::*, + cbor::*, common::{ deserialize, message_format, serialize, Context, Message, MessageDispatch, MessageFormat, SendOpts, Transport, @@ -419,6 +419,7 @@ pub fn decode_ml_error(d: &mut wasmbus_rpc::cbor::Decoder<'_>) -> Result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &RangeLimit, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.u32(val.min)?; e.u32(val.max)?; @@ -132,6 +137,7 @@ pub trait NumberGenReceiver: MessageDispatch + NumberGen { "GenerateGuid" => { let resp = NumberGen::generate_guid(self, ctx).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "NumberGen.GenerateGuid", arg: Cow::Owned(buf), @@ -140,8 +146,10 @@ pub trait NumberGenReceiver: MessageDispatch + NumberGen { "RandomInRange" => { let value: RangeLimit = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'RangeLimit': {}", e)))?; + let resp = NumberGen::random_in_range(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "NumberGen.RandomInRange", arg: Cow::Owned(buf), @@ -150,6 +158,7 @@ pub trait NumberGenReceiver: MessageDispatch + NumberGen { "Random32" => { let resp = NumberGen::random_32(self, ctx).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "NumberGen.Random32", arg: Cow::Owned(buf), @@ -234,6 +243,7 @@ impl NumberGen for NumberG /// The result will will be in the range [min,max), i.e., >= min and < max. async fn random_in_range(&self, ctx: &Context, arg: &RangeLimit) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/sqldb/rust/Cargo.toml b/sqldb/rust/Cargo.toml index 42e4eaa..8d44213 100644 --- a/sqldb/rust/Cargo.toml +++ b/sqldb/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-sqldb" -version = "0.5.0" +version = "0.6.0" description = "Interface for wasmCloud actors to connect to a relational database using the capability 'wasmcloud:sqldb'" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -25,13 +25,12 @@ futures = "0.3" serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" -wasmbus-rpc = "0.8.5" -minicbor = { version = "0.11", features = ["derive", "std", "half"] } +minicbor = { version = "0.17", features = ["derive", "std", "half"] } +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" - +weld-codegen = "0.4.6" diff --git a/sqldb/rust/src/sqldb.rs b/sqldb/rust/src/sqldb.rs index 1b38989..c3d9afe 100644 --- a/sqldb/rust/src/sqldb.rs +++ b/sqldb/rust/src/sqldb.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.sqldb #[allow(unused_imports)] use async_trait::async_trait; @@ -41,7 +43,10 @@ pub struct Column { pub fn encode_column( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &Column, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.u32(val.ordinal)?; e.str(&val.name)?; @@ -124,7 +129,10 @@ pub type Columns = Vec; pub fn encode_columns( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &Columns, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_column(e, item)?; @@ -180,7 +188,10 @@ pub struct ExecuteResult { pub fn encode_execute_result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &ExecuteResult, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.u64(val.rows_affected)?; if let Some(val) = val.error.as_ref() { @@ -279,7 +290,10 @@ pub type Parameters = Vec>; pub fn encode_parameters( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &Parameters, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.bytes(item)?; @@ -325,7 +339,10 @@ pub struct PingResult { pub fn encode_ping_result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &PingResult, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.map(1)?; if let Some(val) = val.error.as_ref() { e.str("error")?; @@ -425,7 +442,10 @@ pub struct QueryResult { pub fn encode_query_result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &QueryResult, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(4)?; e.u64(val.num_rows)?; encode_columns(e, &val.columns)?; @@ -562,7 +582,10 @@ pub struct SqlDbError { pub fn encode_sql_db_error( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &SqlDbError, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; e.str(&val.code)?; e.str(&val.message)?; @@ -644,7 +667,10 @@ pub struct Statement { pub fn encode_statement( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &Statement, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.map(3)?; if let Some(val) = val.database.as_ref() { e.str("database")?; @@ -787,8 +813,10 @@ pub trait SqlDbReceiver: MessageDispatch + SqlDb { "Execute" => { let value: Statement = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'Statement': {}", e)))?; + let resp = SqlDb::execute(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "SqlDb.Execute", arg: Cow::Owned(buf), @@ -797,8 +825,10 @@ pub trait SqlDbReceiver: MessageDispatch + SqlDb { "Query" => { let value: Statement = wasmbus_rpc::common::deserialize(&message.arg) .map_err(|e| RpcError::Deser(format!("'Statement': {}", e)))?; + let resp = SqlDb::query(self, ctx, &value).await?; let buf = wasmbus_rpc::common::serialize(&resp)?; + Ok(Message { method: "SqlDb.Query", arg: Cow::Owned(buf), @@ -858,6 +888,7 @@ impl SqlDb for SqlDbSender /// Execute an sql statement async fn execute(&self, ctx: &Context, arg: &Statement) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( @@ -878,6 +909,7 @@ impl SqlDb for SqlDbSender /// Perform select query on database, returning all result rows async fn query(&self, ctx: &Context, arg: &Statement) -> RpcResult { let buf = wasmbus_rpc::common::serialize(arg)?; + let resp = self .transport .send( diff --git a/testing/rust/Cargo.toml b/testing/rust/Cargo.toml index 01b5f91..fe6e33b 100644 --- a/testing/rust/Cargo.toml +++ b/testing/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmcloud-interface-testing" -version = "0.4.1" +version = "0.5.0" description = "Testing interface (wasmcloud:testing)" repository = "https://github.com/wasmcloud/interfaces" homepage = "https://github.com/wasmcloud/wasmcloud" @@ -23,12 +23,12 @@ regex = "1" serde = { version = "1.0" , features = ["derive"] } serde_json = "1.0" serde_bytes = "0.11" -wasmbus-rpc = "0.8.5" rmp-serde = "0.15.4" +wasmbus-rpc = "0.9" [dev-dependencies] base64 = "0.13" # build-dependencies needed for build.rs [build-dependencies] -weld-codegen = "0.4.3" +weld-codegen = "0.4.6" diff --git a/testing/rust/src/testing.rs b/testing/rust/src/testing.rs index 7676514..095f61f 100644 --- a/testing/rust/src/testing.rs +++ b/testing/rust/src/testing.rs @@ -1,4 +1,6 @@ -// This file is generated automatically using wasmcloud/weld-codegen 0.4.3 +// This file is @generated by wasmcloud/weld-codegen 0.4.6. +// It is not intended for manual editing. +// namespace: org.wasmcloud.interface.testing #[allow(unused_imports)] use async_trait::async_trait; @@ -28,7 +30,10 @@ pub type F32Data = Vec; pub fn encode_f32_data( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &F32Data, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.f32(*item)?; @@ -69,7 +74,10 @@ pub type F64Data = Vec; pub fn encode_f64_data( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &F64Data, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.f64(*item)?; @@ -113,7 +121,10 @@ pub type OptMap = std::collections::HashMap; pub fn encode_opt_map( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &OptMap, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.map(val.len() as u64)?; for (k, v) in val { e.str(k)?; @@ -149,7 +160,10 @@ pub type PatternList = Vec; pub fn encode_pattern_list( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &PatternList, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { e.str(item)?; @@ -207,7 +221,10 @@ pub enum SampleUnion { pub fn encode_sample_union( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &SampleUnion, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ // encoding union SampleUnion e.array(2)?; match val { @@ -299,7 +316,10 @@ pub struct TestOptions { pub fn encode_test_options( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &TestOptions, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(2)?; encode_pattern_list(e, &val.patterns)?; encode_opt_map(e, &val.options)?; @@ -408,7 +428,10 @@ pub struct TestResult { pub fn encode_test_result( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &TestResult, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(3)?; e.str(&val.name)?; e.bool(val.passed)?; @@ -502,7 +525,10 @@ pub type TestResults = Vec; pub fn encode_test_results( mut e: &mut wasmbus_rpc::cbor::Encoder, val: &TestResults, -) -> RpcResult<()> { +) -> RpcResult<()> +where + ::Error: std::fmt::Display, +{ e.array(val.len() as u64)?; for item in val.iter() { encode_test_result(e, item)?; diff --git a/tests/actor/builtins/Cargo.toml b/tests/actor/builtins/Cargo.toml index 9524df4..3ebe1f4 100644 --- a/tests/actor/builtins/Cargo.toml +++ b/tests/actor/builtins/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "builtins-test-actor" -version = "0.1.3" +version = "0.2.0" authors = [ "wasmcloud Team" ] edition = "2018" @@ -15,10 +15,10 @@ serde_json ="1.0" serde = {version = "1.0", features = ["derive"]} regex = "1" -wasmbus-rpc = "0.8" -wasmcloud-interface-numbergen = { path = "../../numbergen/rust" } -wasmcloud-interface-logging = { path = "../../logging/rust" } -wasmcloud-test-util = { path = "../../../wasmcloud-test/wasmcloud-test-util" } +wasmbus-rpc = "0.9" +wasmcloud-interface-numbergen = { path = "../../../numbergen/rust" } +wasmcloud-interface-logging = { path = "../../../logging/rust" } +wasmcloud-test-util = { path = "../../../../wasmcloud-test/wasmcloud-test-util" } # comment out the following if this is inside a cargo workspace #[profile.release]