Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Update/async nats (#79)
Browse files Browse the repository at this point in the history
* async-nats

Signed-off-by: stevelr <[email protected]>

* bump all interfaces patch semver for wasmbus-rpc async-nats

Signed-off-by: stevelr <[email protected]>

* fix crate reference

Signed-off-by: stevelr <[email protected]>

* async-nats updates

Signed-off-by: stevelr <[email protected]>

* bump git rev

Signed-off-by: stevelr <[email protected]>

* change structured_logging_enabled to structured_logging

Signed-off-by: stevelr <[email protected]>

* async-nats: latest wasmbus-rpc

Signed-off-by: stevelr <[email protected]>

* update dependencies

Signed-off-by: stevelr <[email protected]>

* update async dependency

Signed-off-by: stevelr <[email protected]>

* update wasmbus-rpc dep

Signed-off-by: stevelr <[email protected]>

* pinned versions to wasmbus-0.9 and codegen-0.4.6

Signed-off-by: Brooks Townsend <[email protected]>

Co-authored-by: Brooks Townsend <[email protected]>
  • Loading branch information
stevelr and brooksmtownsend authored Jul 6, 2022
1 parent 0585385 commit cd6580d
Show file tree
Hide file tree
Showing 31 changed files with 414 additions and 126 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ members = [
"keyvalue/rust",
"logging/rust",
"messaging/rust",
"ml/rust",
"numbergen/rust",
"sqldb/rust",
"lattice-control/rust",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions blobstore/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"

109 changes: 87 additions & 22 deletions blobstore/rust/src/blobstore.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -48,7 +50,10 @@ pub struct Chunk {
pub fn encode_chunk<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &Chunk,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(5)?;
encode_object_id(e, &val.object_id)?;
encode_container_id(e, &val.container_id)?;
Expand Down Expand Up @@ -189,7 +194,10 @@ pub struct ChunkResponse {
pub fn encode_chunk_response<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ChunkResponse,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(1)?;
e.bool(val.cancel_download)?;
Ok(())
Expand Down Expand Up @@ -250,7 +258,10 @@ pub type ContainerId = String;
pub fn encode_container_id<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ContainerId,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.str(val)?;
Ok(())
}
Expand All @@ -272,7 +283,10 @@ pub type ContainerIds = Vec<ContainerId>;
pub fn encode_container_ids<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ContainerIds,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(val.len() as u64)?;
for item in val.iter() {
encode_container_id(e, item)?;
Expand Down Expand Up @@ -335,7 +349,10 @@ pub struct ContainerMetadata {
pub fn encode_container_metadata<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ContainerMetadata,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(2)?;
encode_container_id(e, &val.container_id)?;
if let Some(val) = val.created_at.as_ref() {
Expand Down Expand Up @@ -447,7 +464,10 @@ pub struct ContainerObject {
pub fn encode_container_object<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ContainerObject,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(2)?;
encode_container_id(e, &val.container_id)?;
encode_object_id(e, &val.object_id)?;
Expand Down Expand Up @@ -548,7 +568,10 @@ pub type ContainersInfo = Vec<ContainerMetadata>;
pub fn encode_containers_info<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ContainersInfo,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(val.len() as u64)?;
for item in val.iter() {
encode_container_metadata(e, item)?;
Expand Down Expand Up @@ -623,7 +646,10 @@ pub struct GetObjectRequest {
pub fn encode_get_object_request<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &GetObjectRequest,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(4)?;
encode_object_id(e, &val.object_id)?;
encode_container_id(e, &val.container_id)?;
Expand Down Expand Up @@ -797,7 +823,10 @@ pub struct GetObjectResponse {
pub fn encode_get_object_response<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &GetObjectResponse,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(6)?;
e.bool(val.success)?;
if let Some(val) = val.error.as_ref() {
Expand Down Expand Up @@ -977,7 +1006,10 @@ pub struct ItemResult {
pub fn encode_item_result<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ItemResult,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(3)?;
e.str(&val.key)?;
e.bool(val.success)?;
Expand Down Expand Up @@ -1105,7 +1137,10 @@ pub struct ListObjectsRequest {
pub fn encode_list_objects_request<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ListObjectsRequest,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(6)?;
e.str(&val.container_id)?;
if let Some(val) = val.start_with.as_ref() {
Expand Down Expand Up @@ -1300,7 +1335,10 @@ pub struct ListObjectsResponse {
pub fn encode_list_objects_response<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ListObjectsResponse,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(3)?;
encode_objects_info(e, &val.objects)?;
e.bool(val.is_last)?;
Expand Down Expand Up @@ -1411,7 +1449,10 @@ pub type MultiResult = Vec<ItemResult>;
pub fn encode_multi_result<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &MultiResult,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(val.len() as u64)?;
for item in val.iter() {
encode_item_result(e, item)?;
Expand Down Expand Up @@ -1465,7 +1506,10 @@ pub type ObjectId = String;
pub fn encode_object_id<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ObjectId,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.str(val)?;
Ok(())
}
Expand All @@ -1485,7 +1529,10 @@ pub type ObjectIds = Vec<ObjectId>;
pub fn encode_object_ids<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ObjectIds,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(val.len() as u64)?;
for item in val.iter() {
encode_object_id(e, item)?;
Expand Down Expand Up @@ -1570,7 +1617,10 @@ pub struct ObjectMetadata {
pub fn encode_object_metadata<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ObjectMetadata,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(6)?;
encode_object_id(e, &val.object_id)?;
encode_container_id(e, &val.container_id)?;
Expand Down Expand Up @@ -1760,7 +1810,10 @@ pub type ObjectsInfo = Vec<ObjectMetadata>;
pub fn encode_objects_info<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &ObjectsInfo,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(val.len() as u64)?;
for item in val.iter() {
encode_object_metadata(e, item)?;
Expand Down Expand Up @@ -1828,7 +1881,10 @@ pub struct PutChunkRequest {
pub fn encode_put_chunk_request<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &PutChunkRequest,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(3)?;
encode_chunk(e, &val.chunk)?;
if let Some(val) = val.stream_id.as_ref() {
Expand Down Expand Up @@ -1948,7 +2004,10 @@ pub struct PutObjectRequest {
pub fn encode_put_object_request<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &PutObjectRequest,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(3)?;
encode_chunk(e, &val.chunk)?;
if let Some(val) = val.content_type.as_ref() {
Expand Down Expand Up @@ -2071,7 +2130,10 @@ pub struct PutObjectResponse {
pub fn encode_put_object_response<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &PutObjectResponse,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(1)?;
if let Some(val) = val.stream_id.as_ref() {
e.str(val)?;
Expand Down Expand Up @@ -2152,7 +2214,10 @@ pub struct RemoveObjectsRequest {
pub fn encode_remove_objects_request<W: wasmbus_rpc::cbor::Write>(
mut e: &mut wasmbus_rpc::cbor::Encoder<W>,
val: &RemoveObjectsRequest,
) -> RpcResult<()> {
) -> RpcResult<()>
where
<W as wasmbus_rpc::cbor::Write>::Error: std::fmt::Display,
{
e.array(2)?;
encode_container_id(e, &val.container_id)?;
encode_object_ids(e, &val.objects)?;
Expand Down
5 changes: 3 additions & 2 deletions core/wasmcloud-core.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions factorial/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"

7 changes: 6 additions & 1 deletion factorial/rust/src/factorial.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -135,6 +139,7 @@ impl<T: Transport + std::marker::Sync + std::marker::Send> Factorial for Factori
/// Calculates the factorial (n!) of the input parameter
async fn calculate(&self, ctx: &Context, arg: &u32) -> RpcResult<u64> {
let buf = wasmbus_rpc::common::serialize(arg)?;

let resp = self
.transport
.send(
Expand Down
3 changes: 2 additions & 1 deletion httpclient/codegen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]


Expand Down
6 changes: 3 additions & 3 deletions httpclient/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"

Loading

0 comments on commit cd6580d

Please sign in to comment.