componentized/directory

componentized:valkey

interface

A WASM component client for Valkey (and Redis).

interface store componentized:valkey/store

Types

use type resp-error

from componentized:valkey/resp

  • string

use variant value

from componentized:valkey/resp

variant error

  • client: string

    Client errors can represent semantic issues with input/output values, or connection errors communicating with the server

  • resp: resp-error

    RESP errors are encoding issues converting values to/from bytes

  • valkey: string

    Valkey errors are Error or BulkError values returned directly from the server

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

  • functionsend: func(command: list<value>) -> result<value, error>
  • functionacl-deluser: func(username: string) -> result<_, error>
  • functionacl-genpass: func() -> result<string, error>
  • functionacl-setuser: func( username: string, rules: list<string>, ) -> result<_, error>
  • functionauth: func(username: string, password: string) -> result<_, error>
  • functiondel: func(key: string) -> result<_, error>
  • functionexists: func(key: string) -> result<bool, error>
  • functionget: func(key: string) -> result<option<string>, error>
  • functionhdel: func(key: string, field: string) -> result<_, error>
  • functionhello: func( opts: option<hello-opts>, ) -> result<list<tuple<string, value>>, error>
  • functionhexists: func(key: string, field: string) -> result<bool, error>
  • functionhget: func(key: string, field: string) -> result<option<string>, error>
  • functionhgetall: func(key: string) -> result<list<tuple<string, string>>, error>
  • functionhincrby: func( key: string, field: string, increment: s64, ) -> result<s64, error>
  • functionhincrbyfloat: func( key: string, field: string, increment: f64, ) -> result<string, error>
  • functionhkeys: func(key: string) -> result<list<string>, error>
  • functionhlen: func(key: string) -> result<u64, error>
  • functionhmget: func( key: string, fields: list<string>, ) -> result<list<option<string>>, error>
  • functionhmset: func( key: string, fields: list<tuple<string, string>>, ) -> result<_, error>
  • functionhrandfield: func( key: string, opts: option<hrandfield-opts>, ) -> result<option<list<tuple<string, option<string>>>>, error>
  • functionhscan: func( key: string, cursor: option<string>, opts: option<hscan-opts>, ) -> result<tuple<option<string>, list<tuple<string, option<string>>>>, error>
  • functionhset: func( key: string, field: string, value: string, ) -> result<_, error>
  • functionhsetnx: func( key: string, field: string, value: string, ) -> result<bool, error>
  • functionhstrlen: func(key: string, field: string) -> result<u64, error>
  • functionhvals: func(key: string) -> result<list<string>, error>
  • functionincr: func(key: string) -> result<s64, error>
  • functionincrby: func(key: string, increment: s64) -> result<s64, error>
  • functionkeys: func(pattern: string) -> result<list<string>, error>
  • functionping: func() -> result<_, error>
  • functionpublish: func(channel: string, message: string) -> result<s64, error>
  • functionquit: func() -> result<_, error>
  • functionset: func(key: string, value: string) -> result<_, error>

Functions

functionconnect: func( host: string, port: u16, opts: option<hello-opts>, ) -> result<connection, error>

WIT

interface store {
  use resp.{error as resp-error, value};

  variant error {
    /// Client errors can represent semantic issues with input/output values, or connection errors communicating with the server
    client(string),
    /// RESP errors are encoding issues converting values to/from bytes
    resp(resp-error),
    /// Valkey errors are Error or BulkError values returned directly from the server
    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>;
}