Skip to content

Commit

Permalink
more worlds
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Fontes <[email protected]>
  • Loading branch information
lxfontes committed Sep 12, 2024
1 parent 01b8d36 commit 4687df4
Show file tree
Hide file tree
Showing 22 changed files with 385 additions and 16 deletions.
4 changes: 4 additions & 0 deletions gen/wasi/config/imports/imports.wit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions gen/wasi/config/runtime/abi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions gen/wasi/config/runtime/empty.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.
84 changes: 84 additions & 0 deletions gen/wasi/config/runtime/runtime.wit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions gen/wasmcloud/component/imports/imports.wit.go

This file was deleted.

4 changes: 4 additions & 0 deletions gen/wasmcloud/component/sdk/sdk.wit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions gen/wasmcloud/messaging/consumer/abi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions gen/wasmcloud/messaging/consumer/consumer.wit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions gen/wasmcloud/messaging/consumer/empty.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.
22 changes: 22 additions & 0 deletions gen/wasmcloud/messaging/handler/abi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions gen/wasmcloud/messaging/handler/empty.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.
18 changes: 18 additions & 0 deletions gen/wasmcloud/messaging/handler/handler.exports.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions gen/wasmcloud/messaging/handler/handler.wit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions gen/wasmcloud/messaging/types/types.wit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions sdk.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package component

//go:generate wit-bindgen-go generate --world imports --out gen ./wit
//go:generate wit-bindgen-go generate --world sdk --out gen ./wit

import (
"embed"
"log/slog"

"go.wasmcloud.dev/component/log/wasilog"
"go.wasmcloud.dev/component/net"

// TODO(lxf): Investigate if it is better to remove this import and let callers go directly to wasihttp
// Would allow callers to avoid importing wasmcloud:component world.
_ "go.wasmcloud.dev/component/net/wasihttp"
)

//go:embed wit/*
Expand Down
20 changes: 15 additions & 5 deletions wit/deps.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ sha512 = "da2622210a9e3eea82b99f1a5b8a44ce5443d009cb943f7bca0bf9cf4360829b289913
sha256 = "468b4d12892fe926b8eb5d398dbf579d566c93231fa44f415440572c695b7613"
sha512 = "e6b53a07221f1413953c9797c68f08b815fdaebf66419bbc1ea3e8b7dece73731062693634731f311a03957b268cf9cc509c518bd15e513c318aa04a8459b93a"

[config]
url = "https://github.com/WebAssembly/wasi-runtime-config/archive/main.tar.gz"
sha256 = "9148c06861712b69170af7b8ec37896b4104297d920fdec9f3bcc0b1eee4a5c8"
sha512 = "25a54101620f279c835b39f56f6dbf8a92b374b6faaf6cf6aaa1ea06d8b97b9b79788cf8abd9c2ad0c11e3629dba6a2513b71f2c54b9f95027054ae54a4615b8"

[filesystem]
sha256 = "498c465cfd04587db40f970fff2185daa597d074c20b68a8bcbae558f261499b"
sha512 = "ead452f9b7bfb88593a502ec00d76d4228003d51c40fd0408aebc32d35c94673551b00230d730873361567cc209ec218c41fb4e95bad194268592c49e7964347"
Expand All @@ -20,20 +25,25 @@ deps = ["cli", "clocks", "filesystem", "io", "random", "sockets"]
sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"

[lattice]
url = "https://github.com/wasmCloud/wasmCloud/archive/refs/tags/v1.2.0.tar.gz"
sha256 = "b4946a8bfa48b2f4ac404de03617d25712879596be5417bde3de09ca9c369462"
sha512 = "09918bb2fa8f7af022f71453348be38ec7fd1a35df6809b8d0c5f246856712f969557ff65d9e5d4619e905191e27fba2fbbcc9f38c777a7b09eb73c30909d33f"

[logging]
url = "https://github.com/WebAssembly/wasi-logging/archive/main.tar.gz"
sha256 = "9676b482485bb0fd2751a390374c1108865a096b7037f4b5dbe524f066bfb06e"
sha512 = "30a621a6d48a0175e8047c062e618523a85f69c45a7c31918da2b888f7527fce1aca67fa132552222725d0f6cdcaed95be7f16c28488d9468c0fad00cb7450b9"

[messaging]
url = "https://github.com/wasmCloud/messaging/archive/v0.2.0.tar.gz"
sha256 = "41ada083aceb2b4ba92d9bd16d19b6462cc02b10378c9a49135c3447f9138a44"
sha512 = "aa9c819dfd9e85b19661f6087ffd824c44fc38c8a4bc1005c4e7fd34fe844633c52cae7a0412e9ea90f71826e0660e8a3b5672a0f0303c524e4139643ae675ac"

[random]
sha256 = "7371d03c037d924caba2587fb2e7c5773a0d3c5fcecbf7971e0e0ba57973c53d"
sha512 = "964c4e8925a53078e4d94ba907b54f89a0b7e154f46823a505391471466c17f53c8692682e5c85771712acd88b348686173fc07c53a3cfe3d301b8cd8ddd0de4"

[sockets]
sha256 = "622bd28bbeb43736375dc02bd003fd3a016ff8ee91e14bab488325c6b38bf966"
sha512 = "5a63c1f36de0c4548e1d2297bdbededb28721cbad94ef7825c469eae29d7451c97e00b4c1d6730ee1ec0c4a5aac922961a2795762d4a0c3bb54e30a391a84bae"

[wasmcloud]
url = "https://github.com/wasmCloud/wasmCloud/archive/refs/tags/v1.2.0.tar.gz"
sha256 = "b4946a8bfa48b2f4ac404de03617d25712879596be5417bde3de09ca9c369462"
sha512 = "09918bb2fa8f7af022f71453348be38ec7fd1a35df6809b8d0c5f246856712f969557ff65d9e5d4619e905191e27fba2fbbcc9f38c777a7b09eb73c30909d33f"
4 changes: 3 additions & 1 deletion wit/deps.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
http = "https://github.com/WebAssembly/wasi-http/archive/v0.2.0.tar.gz"
config = "https://github.com/WebAssembly/wasi-runtime-config/archive/main.tar.gz"
logging = "https://github.com/WebAssembly/wasi-logging/archive/main.tar.gz"
wasmcloud = "https://github.com/wasmCloud/wasmCloud/archive/refs/tags/v1.2.0.tar.gz"
lattice = "https://github.com/wasmCloud/wasmCloud/archive/refs/tags/v1.2.0.tar.gz"
messaging = "https://github.com/wasmCloud/messaging/archive/v0.2.0.tar.gz"
25 changes: 25 additions & 0 deletions wit/deps/config/runtime_config.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
interface runtime {
/// An error type that encapsulates the different errors that can occur fetching config
variant config-error {
/// This indicates an error from an "upstream" config source.
/// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue buckets, etc),
/// the error message is a string.
upstream(string),
/// This indicates an error from an I/O operation.
/// As this could be almost _anything_ (such as a file read, network connection, etc),
/// the error message is a string.
/// Depending on how this ends up being consumed,
/// we may consider moving this to use the `wasi:io/error` type instead.
/// For simplicity right now in supporting multiple implementations, it is being left as a string.
io(string),
}

/// Gets a single opaque config value set at the given key if it exists
get: func(
/// A string key to fetch
key: string
) -> result<option<string>, config-error>;

/// Gets a list of all set config data
get-all: func() -> result<list<tuple<string, string>>, config-error>;
}
6 changes: 6 additions & 0 deletions wit/deps/config/world.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package wasi:config@0.2.0-draft;

world imports {
/// The runtime interface for config
import runtime;
}
Loading

0 comments on commit 4687df4

Please sign in to comment.