add runtime (nun va)
This commit is contained in:
parent
12f83f6286
commit
93344915b9
@ -9,6 +9,8 @@ import (
|
||||
|
||||
// ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error".
|
||||
//
|
||||
// An error type that encapsulates the different errors that can occur fetching config
|
||||
//
|
||||
// variant config-error {
|
||||
// upstream(string),
|
||||
// io(string),
|
||||
@ -16,6 +18,11 @@ import (
|
||||
type ConfigError cm.Variant[uint8, string, string]
|
||||
|
||||
// ConfigErrorUpstream returns a [ConfigError] of case "upstream".
|
||||
//
|
||||
// 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.
|
||||
func ConfigErrorUpstream(data string) ConfigError {
|
||||
return cm.New[ConfigError](0, data)
|
||||
}
|
||||
@ -26,6 +33,14 @@ func (self *ConfigError) Upstream() *string {
|
||||
}
|
||||
|
||||
// ConfigErrorIO returns a [ConfigError] of case "io".
|
||||
//
|
||||
// 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.
|
||||
func ConfigErrorIO(data string) ConfigError {
|
||||
return cm.New[ConfigError](1, data)
|
||||
}
|
||||
@ -47,6 +62,8 @@ func (v ConfigError) String() string {
|
||||
|
||||
// Get represents the imported function "get".
|
||||
//
|
||||
// Gets a single opaque config value set at the given key if it exists
|
||||
//
|
||||
// get: func(key: string) -> result<option<string>, config-error>
|
||||
//
|
||||
//go:nosplit
|
||||
@ -58,6 +75,8 @@ func Get(key string) (result cm.Result[OptionStringShape, cm.Option[string], Con
|
||||
|
||||
// GetAll represents the imported function "get-all".
|
||||
//
|
||||
// Gets a list of all set config data
|
||||
//
|
||||
// get-all: func() -> result<list<tuple<string, string>>, config-error>
|
||||
//
|
||||
//go:nosplit
|
||||
|
@ -2,10 +2,10 @@ package wasmcloud:component-go@0.1.0;
|
||||
|
||||
package wasmcloud:hello {
|
||||
world hello {
|
||||
import wasi:config/runtime@0.2.0-draft;
|
||||
import wasmcloud:messaging/types@0.2.0;
|
||||
import wasmcloud:messaging/consumer@0.2.0;
|
||||
import wasi:logging/logging@0.1.0-draft;
|
||||
import wasi:config/runtime@0.2.0-draft;
|
||||
import wasi:io/poll@0.2.0;
|
||||
import wasi:clocks/monotonic-clock@0.2.0;
|
||||
import wasi:io/error@0.2.0;
|
||||
@ -115,11 +115,27 @@ package wasi:clocks@0.2.0 {
|
||||
|
||||
package wasi:config@0.2.0-draft {
|
||||
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(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>;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,28 @@
|
||||
package wasi:config@0.2.0-draft;
|
||||
|
||||
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(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>;
|
||||
}
|
||||
|
||||
world imports {
|
||||
import runtime;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package wasmcloud:hello;
|
||||
world hello {
|
||||
include wasmcloud:component-go/imports@0.1.0;
|
||||
|
||||
import wasi:config/runtime@0.2.0-draft;
|
||||
|
||||
export wasmcloud:messaging/handler@0.2.0;
|
||||
import wasmcloud:messaging/consumer@0.2.0;
|
||||
import wasi:logging/logging@0.1.0-draft;
|
||||
|
Loading…
Reference in New Issue
Block a user