forked from wasmCloud/wasmCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
world.wit
39 lines (33 loc) · 1.17 KB
/
world.wit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package wasmcloud:example;
// This interface is generic and includes a function to process some
// data, returning a string result.
// We'll use this to send structured data to a component for processing.
interface process-data {
record data {
name: string,
count: u32,
}
// Send structured data to the component for processing
process: func(data: data) -> string;
}
// While processing data, sometimes a component may need to request
// information about the system it's running on. The component isn't
// allowed to access this information directly, so it can request it
// from the provider.
interface system-info {
enum kind {
OS,
ARCH,
}
// Request information about the system the provider is running on
request-info: func(kind: kind) -> string;
// Example export to call from the provider for testing
call: func() -> string;
}
// The `world` defines all of the imports and exports our provider can use / must implement.
world provider {
// Providers `import` functions that it can call on a component
import process-data;
// Providers `export` functions that a component can call
export system-info;
}