generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specify config to never change during the lifetime of the component.
- Loading branch information
Showing
2 changed files
with
19 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,19 @@ | ||
/// An immutable configuration store. | ||
interface store { | ||
/// An error type that encapsulates the different errors that can occur fetching configuration values. | ||
variant 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 configuration value of type `string` associated with the `key`. | ||
/// | ||
/// The value is returned as an `option<string>`. If the key is not found, | ||
/// `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned. | ||
/// | ||
/// Returns `none` if the key does not exist. | ||
/// | ||
/// This always returns the same value for any given key. Configuration | ||
/// data does not change over the lifetime of the component instance. | ||
get: func( | ||
/// A string key to fetch | ||
key: string | ||
) -> result<option<string>, error>; | ||
) -> option<string>; | ||
|
||
/// Gets a list of configuration key-value pairs of type `string`. | ||
/// | ||
/// If an error occurs, an `Err(error)` is returned. | ||
get-all: func() -> result<list<tuple<string, string>>, error>; | ||
/// | ||
/// This always returns the same data. Configuration data does not change | ||
/// over the lifetime of the component instance. | ||
get-all: func() -> list<tuple<string, string>>; | ||
} |