Imports
- interface
wasi:sockets/network@0.2.3 - interface
wasi:sockets/instance-network@0.2.3 - interface
wasi:io/poll@0.2.3 - interface
wasi:io/error@0.2.3 - interface
wasi:io/streams@0.2.3 - interface
wasi:sockets/tcp@0.2.3 - interface
wasi:sockets/tcp-create-socket@0.2.3 - interface
wasi:sockets/ip-name-lookup@0.2.3
Exports
- interface
componentized:valkey/resp - interface
componentized:valkey/store
WIT
package root:component;
world root {
import wasi:sockets/network@0.2.3;
import wasi:sockets/instance-network@0.2.3;
import wasi:io/poll@0.2.3;
import wasi:io/error@0.2.3;
import wasi:io/streams@0.2.3;
import wasi:sockets/tcp@0.2.3;
import wasi:sockets/tcp-create-socket@0.2.3;
import wasi:sockets/ip-name-lookup@0.2.3;
export componentized:valkey/resp;
export componentized:valkey/store;
}
The WIT of its dependencies, as it was built against them
This version keeps the parts of its dependencies it uses, as they were when it was built: their indexed versions differ from them, e.g. a pre-release that has since moved, or aren't indexed.
package componentized:valkey {
interface resp {
type error = string;
type nested-value = list<u8>;
variant value {
%string(string),
error(string),
integer(s64),
bulk-string(string),
array(list<nested-value>),
null,
boolean(bool),
double(f64),
big-number(string),
bulk-error(string),
verbatim-string(tuple<string, string>),
%map(list<tuple<nested-value, nested-value>>),
set(list<nested-value>),
push(list<nested-value>),
}
decode: func(data: list<u8>) -> result<value, error>;
encode: func(value: value) -> result<list<u8>, error>;
}
interface store {
use resp.{error as resp-error, value};
variant error {
client(string),
resp(resp-error),
valkey(string),
}
record hello-opts {
proto-ver: option<string>,
auth: option<tuple<string, string>>,
client-name: option<string>,
}
record hrandfield-opts {
count: option<s64>,
with-values: option<bool>,
}
record hscan-opts {
match: option<string>,
count: option<s64>,
no-values: option<bool>,
}
resource connection {
send: func(command: list<value>) -> result<value, error>;
acl-deluser: func(username: string) -> result<_, error>;
acl-genpass: func() -> result<string, error>;
acl-setuser: func(username: string, rules: list<string>) -> result<_, error>;
auth: func(username: string, password: string) -> result<_, error>;
del: func(key: string) -> result<_, error>;
exists: func(key: string) -> result<bool, error>;
get: func(key: string) -> result<option<string>, error>;
hdel: func(key: string, field: string) -> result<_, error>;
hello: func(opts: option<hello-opts>) -> result<list<tuple<string, value>>, error>;
hexists: func(key: string, field: string) -> result<bool, error>;
hget: func(key: string, field: string) -> result<option<string>, error>;
hgetall: func(key: string) -> result<list<tuple<string, string>>, error>;
hincrby: func(key: string, field: string, increment: s64) -> result<s64, error>;
hincrbyfloat: func(key: string, field: string, increment: f64) -> result<string, error>;
hkeys: func(key: string) -> result<list<string>, error>;
hlen: func(key: string) -> result<u64, error>;
hmget: func(key: string, fields: list<string>) -> result<list<option<string>>, error>;
hmset: func(key: string, fields: list<tuple<string, string>>) -> result<_, error>;
hrandfield: func(key: string, opts: option<hrandfield-opts>) -> result<option<list<tuple<string, option<string>>>>, error>;
hscan: func(key: string, cursor: option<string>, opts: option<hscan-opts>) -> result<tuple<option<string>, list<tuple<string, option<string>>>>, error>;
hset: func(key: string, field: string, value: string) -> result<_, error>;
hsetnx: func(key: string, field: string, value: string) -> result<bool, error>;
hstrlen: func(key: string, field: string) -> result<u64, error>;
hvals: func(key: string) -> result<list<string>, error>;
incr: func(key: string) -> result<s64, error>;
incrby: func(key: string, increment: s64) -> result<s64, error>;
keys: func(pattern: string) -> result<list<string>, error>;
ping: func() -> result<_, error>;
publish: func(channel: string, message: string) -> result<s64, error>;
quit: func() -> result<_, error>;
set: func(key: string, value: string) -> result<_, error>;
}
connect: func(host: string, port: u16, opts: option<hello-opts>) -> result<connection, error>;
}
}
package wasi:io@0.2.3 {
interface poll {
resource pollable {
block: func();
}
}
interface error {
resource error {
to-debug-string: func() -> string;
}
}
interface streams {
use error.{error};
resource input-stream {
blocking-read: func(len: u64) -> result<list<u8>, stream-error>;
}
variant stream-error {
last-operation-failed(error),
closed,
}
resource output-stream {
blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
}
}
}
package wasi:sockets@0.2.3 {
interface network {
resource network;
type ipv4-address = tuple<u8, u8, u8, u8>;
record ipv4-socket-address {
port: u16,
address: ipv4-address,
}
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;
record ipv6-socket-address {
port: u16,
flow-info: u32,
address: ipv6-address,
scope-id: u32,
}
variant ip-socket-address {
ipv4(ipv4-socket-address),
ipv6(ipv6-socket-address),
}
enum error-code {
unknown,
access-denied,
not-supported,
invalid-argument,
out-of-memory,
timeout,
concurrency-conflict,
not-in-progress,
would-block,
invalid-state,
new-socket-limit,
address-not-bindable,
address-in-use,
remote-unreachable,
connection-refused,
connection-reset,
connection-aborted,
datagram-too-large,
name-unresolvable,
temporary-resolver-failure,
permanent-resolver-failure,
}
enum ip-address-family {
ipv4,
ipv6,
}
variant ip-address {
ipv4(ipv4-address),
ipv6(ipv6-address),
}
}
interface instance-network {
use network.{network};
instance-network: func() -> network;
}
interface tcp {
use network.{network, ip-socket-address, error-code};
use wasi:io/streams@0.2.3.{input-stream, output-stream};
use wasi:io/poll@0.2.3.{pollable};
resource tcp-socket {
start-connect: func(network: borrow<network>, remote-address: ip-socket-address) -> result<_, error-code>;
finish-connect: func() -> result<tuple<input-stream, output-stream>, error-code>;
subscribe: func() -> pollable;
}
}
interface tcp-create-socket {
use network.{ip-address-family};
use tcp.{tcp-socket};
use network.{error-code};
create-tcp-socket: func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
}
interface ip-name-lookup {
use network.{ip-address, error-code};
use wasi:io/poll@0.2.3.{pollable};
use network.{network};
resource resolve-address-stream {
resolve-next-address: func() -> result<option<ip-address>, error-code>;
subscribe: func() -> pollable;
}
resolve-addresses: func(network: borrow<network>, name: string) -> result<resolve-address-stream, error-code>;
}
}