From 44bb36307a771469dca6cb67e3e489a54f65a773 Mon Sep 17 00:00:00 2001 From: "Jiaxiao Zhou (Mossaka)" Date: Mon, 22 Jan 2024 12:54:23 -0800 Subject: [PATCH 1/3] add a version to wasi:keyvalue package Signed-off-by: Jiaxiao Zhou (Mossaka) --- wit/world.wit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wit/world.wit b/wit/world.wit index fc922b6..ea64fe5 100644 --- a/wit/world.wit +++ b/wit/world.wit @@ -1,4 +1,4 @@ -package wasi:keyvalue; +package wasi:keyvalue@0.1.0; /// The `wasi:keyvalue/imports` world provides common APIs for interacting /// with key-value stores. Components targeting this world will be able to From 2f4df2a716eb56912d360d61c37a27db665d3d1b Mon Sep 17 00:00:00 2001 From: "Jiaxiao Zhou (Mossaka)" Date: Mon, 22 Jan 2024 12:56:06 -0800 Subject: [PATCH 2/3] chore(*): update the markdown files Signed-off-by: Jiaxiao Zhou (Mossaka) --- imports.md | 292 ++++++++++++++++++------------------ keyvalue-handle-watch.md | 316 +++++++++++++++++++-------------------- 2 files changed, 304 insertions(+), 304 deletions(-) diff --git a/imports.md b/imports.md index d8affb7..812bf03 100644 --- a/imports.md +++ b/imports.md @@ -13,18 +13,18 @@ do

  • interface wasi:io/error@0.2.0-rc-2023-11-10
  • interface wasi:io/poll@0.2.0-rc-2023-11-10
  • interface wasi:io/streams@0.2.0-rc-2023-11-10
  • -
  • interface wasi:keyvalue/wasi-keyvalue-error
  • -
  • interface wasi:keyvalue/types
  • -
  • interface wasi:keyvalue/eventual
  • -
  • interface wasi:keyvalue/atomic
  • -
  • interface wasi:keyvalue/eventual-batch
  • +
  • interface wasi:keyvalue/wasi-keyvalue-error@0.1.0
  • +
  • interface wasi:keyvalue/types@0.1.0
  • +
  • interface wasi:keyvalue/eventual@0.1.0
  • +
  • interface wasi:keyvalue/atomic@0.1.0
  • +
  • interface wasi:keyvalue/eventual-batch@0.1.0
  • -

    Import interface wasi:io/error@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/error@0.2.0-rc-2023-11-10


    Types

    -

    resource error

    +

    resource error

    A resource which represents some error information.

    The only method provided by this resource is to-debug-string, which provides some human-readable information about the error.

    @@ -41,7 +41,7 @@ error-code type, using the function

    The set of functions which can "downcast" an error into a more concrete type is open.

    Functions

    -

    [method]error.to-debug-string: func

    +

    [method]error.to-debug-string: func

    Returns a string that is suitable to assist humans in debugging this error.

    WARNING: The returned string should not be consumed mechanically! @@ -50,41 +50,41 @@ details. Parsing this string is a major platform-compatibility hazard.

    Params
    Return values
    • string
    -

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    A poll API intended to let users wait for I/O events on multiple handles at once.


    Types

    -

    resource pollable

    +

    resource pollable

    pollable epresents a single I/O event which may be ready, or not.

    Functions

    -

    [method]pollable.ready: func

    +

    [method]pollable.ready: func

    Return the readiness of a pollable. This function never blocks.

    Returns true when the pollable is ready, and false otherwise.

    Params
    Return values
    • bool
    -

    [method]pollable.block: func

    +

    [method]pollable.block: func

    block returns immediately if the pollable is ready, and otherwise blocks until ready.

    This function is equivalent to calling poll.poll on a list containing only this pollable.

    Params
    -

    poll: func

    +

    poll: func

    Poll for completion on a set of pollables.

    This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

    @@ -100,42 +100,42 @@ the pollables has an error, it is indicated by marking the source as being reaedy for I/O.

    Params
    Return values
    • list<u32>
    -

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    WASI I/O is an I/O abstraction API which is currently focused on providing stream types.

    In the future, the component model is expected to add built-in stream types; when it does, they are expected to subsume this API.


    Types

    -

    type error

    +

    type error

    error

    -#### `type pollable` +#### `type pollable` [`pollable`](#pollable)

    -#### `variant stream-error` +#### `variant stream-error`

    An error for input-stream and output-stream operations.

    Variant Cases
    • -

      last-operation-failed: own<error>

      +

      last-operation-failed: own<error>

      The last operation (a write or flush) failed before completion.

      More information is available in the error payload.

    • -

      closed

      +

      closed

      The stream is closed: no more input will be accepted by the stream. A closed output-stream will return this error on all future operations.

    -

    resource input-stream

    +

    resource input-stream

    An input bytestream.

    input-streams are non-blocking to the extent practical on underlying platforms. I/O operations always return promptly; if fewer bytes are @@ -143,7 +143,7 @@ promptly available than requested, they return the number of bytes promptly available, which could even be zero. To wait for data to be available, use the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    -

    resource output-stream

    +

    resource output-stream

    An output bytestream.

    output-streams are non-blocking to the extent practical on underlying platforms. Except where specified otherwise, I/O operations also @@ -152,7 +152,7 @@ promptly, which could even be zero. To wait for the stream to be ready to accept data, the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    Functions

    -

    [method]input-stream.read: func

    +

    [method]input-stream.read: func

    Perform a non-blocking read from the stream.

    This function returns a list of bytes containing the read data, when successful. The returned list will contain up to len bytes; @@ -172,51 +172,51 @@ as a return value by the callee. The callee may return a list of bytes less than len in size while more bytes are available for reading.

    Params
    Return values
    -

    [method]input-stream.blocking-read: func

    +

    [method]input-stream.blocking-read: func

    Read bytes from a stream, after blocking until at least one byte can be read. Except for blocking, behavior is identical to read.

    Params
    Return values
    -

    [method]input-stream.skip: func

    +

    [method]input-stream.skip: func

    Skip bytes from a stream. Returns number of bytes skipped.

    Behaves identical to read, except instead of returning a list of bytes, returns the number of bytes consumed from the stream.

    Params
    Return values
    -

    [method]input-stream.blocking-skip: func

    +

    [method]input-stream.blocking-skip: func

    Skip bytes from a stream, after blocking until at least one byte can be skipped. Except for blocking behavior, identical to skip.

    Params
    Return values
    -

    [method]input-stream.subscribe: func

    +

    [method]input-stream.subscribe: func

    Create a pollable which will resolve once either the specified stream has bytes available to read or the other end of the stream has been closed. @@ -225,13 +225,13 @@ Implementations may trap if the input-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.check-write: func

    +

    [method]output-stream.check-write: func

    Check readiness for writing. This function never blocks.

    Returns the number of bytes permitted for the next call to write, or an error. Calling write with more bytes than this function has @@ -241,13 +241,13 @@ become ready when this function will report at least 1 byte, or an error.

    Params
    Return values
    -

    [method]output-stream.write: func

    +

    [method]output-stream.write: func

    Perform a write. This function never blocks.

    Precondition: check-write gave permit of Ok(n) and contents has a length of less than or equal to n. Otherwise, this function will trap.

    @@ -255,14 +255,14 @@ length of less than or equal to n. Otherwise, this function will trap.

    the last call to check-write provided a permit.

    Params
    Return values
    -

    [method]output-stream.blocking-write-and-flush: func

    +

    [method]output-stream.blocking-write-and-flush: func

    Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    This is a convenience wrapper around the use of check-write, @@ -286,14 +286,14 @@ let _ = this.check-write(); // eliding error handling

    Params
    Return values
    -

    [method]output-stream.flush: func

    +

    [method]output-stream.flush: func

    Request to flush buffered output. This function never blocks.

    This tells the output-stream that the caller intends any buffered output to be flushed. the output which is expected to be flushed @@ -304,24 +304,24 @@ completed. The subscribe pollable will become ready when the flush has completed and the stream can accept more writes.

    Params
    Return values
    -

    [method]output-stream.blocking-flush: func

    +

    [method]output-stream.blocking-flush: func

    Request to flush buffered output, and block until flush completes and stream is ready for writing again.

    Params
    Return values
    -

    [method]output-stream.subscribe: func

    +

    [method]output-stream.subscribe: func

    Create a pollable which will resolve once the output-stream is ready for more writing, or an error has occured. When this pollable is ready, check-write will return ok(n) with n>0, or an @@ -332,13 +332,13 @@ Implementations may trap if the output-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.write-zeroes: func

    +

    [method]output-stream.write-zeroes: func

    Write zeroes to a stream.

    this should be used precisely like write with the exact same preconditions (must use check-write first), but instead of @@ -346,14 +346,14 @@ passing a list of bytes, you simply pass the number of zero-bytes that should be written.

    Params
    Return values
    -

    [method]output-stream.blocking-write-zeroes-and-flush: func

    +

    [method]output-stream.blocking-write-zeroes-and-flush: func

    Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    @@ -377,14 +377,14 @@ let _ = this.check-write(); // eliding error handling
    Params
    Return values
    -

    [method]output-stream.splice: func

    +

    [method]output-stream.splice: func

    Read from one stream and write to another.

    The behavior of splice is equivelant to:

      @@ -399,33 +399,33 @@ let _ = this.check-write(); // eliding error handling than len.

      Params
      Return values
      -

      [method]output-stream.blocking-splice: func

      +

      [method]output-stream.blocking-splice: func

      Read from one stream and write to another, with blocking.

      This is similar to splice, except that it blocks until the output-stream is ready for writing, and the input-stream is ready for reading, before performing the splice.

      Params
      Return values
      -

      Import interface wasi:keyvalue/wasi-keyvalue-error

      +

      Import interface wasi:keyvalue/wasi-keyvalue-error@0.1.0


      Types

      -

      resource error

      +

      resource error

      An error resource type for keyvalue operations.

      Common errors:

        @@ -442,29 +442,29 @@ of the error. In the future, this will be extended to provide more information about the error. Soon: switch to resource error { ... }

        Functions

        -

        [method]error.trace: func

        +

        [method]error.trace: func

        Params
        Return values
        • string
        -

        Import interface wasi:keyvalue/types

        +

        Import interface wasi:keyvalue/types@0.1.0

        A generic keyvalue interface for WASI.


        Types

        -

        type input-stream

        +

        type input-stream

        input-stream

        -#### `type output-stream` +#### `type output-stream` [`output-stream`](#output_stream)

        -#### `type error` +#### `type error` [`error`](#error)

        -#### `resource bucket` +#### `resource bucket`

        A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the bucket, and the bucket itself acts as a collection of all these entries.

        @@ -481,22 +481,22 @@ can very depending on the specific implementation. For example,

    In this interface, we use the term bucket to refer to a collection of key-value Soon: switch to resource bucket { ... }

    -

    type key

    +

    type key

    string

    A key is a unique identifier for a value in a bucket. The key is used to retrieve the value from the bucket. -

    resource outgoing-value

    +

    resource outgoing-value

    A value is the data stored in a key-value pair. The value can be of any type that can be represented in a byte array. It provides a way to write the value to the output-stream defined in the wasi-io interface. Soon: switch to resource value { ... }

    -

    type outgoing-value-body-async

    +

    type outgoing-value-body-async

    output-stream

    -#### `type outgoing-value-body-sync` +#### `type outgoing-value-body-sync` [`outgoing-value-body-sync`](#outgoing_value_body_sync)

    -#### `resource incoming-value` +#### `resource incoming-value`

    A incoming-value is a wrapper around a value. It provides a way to read the value from the input-stream defined in the wasi-io interface.

    The incoming-value provides two ways to consume the value:

    @@ -510,87 +510,87 @@ This is useful when the value is large and the caller wants to allocate a buffer the right size to consume the value. Soon: switch to resource incoming-value { ... } -

    type incoming-value-async-body

    +

    type incoming-value-async-body

    input-stream

    -#### `type incoming-value-sync-body` +#### `type incoming-value-sync-body` [`incoming-value-sync-body`](#incoming_value_sync_body)

    ----

    Functions

    -

    [static]bucket.open-bucket: func

    +

    [static]bucket.open-bucket: func

    Opens a bucket with the given name.

    If any error occurs, including if the bucket does not exist, it returns an Err(error).

    Params
      -
    • name: string
    • +
    • name: string
    Return values
    -

    [static]outgoing-value.new-outgoing-value: func

    +

    [static]outgoing-value.new-outgoing-value: func

    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-async: func

    +

    [method]outgoing-value.outgoing-value-write-body-async: func

    Writes the value to the output-stream asynchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-sync: func

    +

    [method]outgoing-value.outgoing-value-write-body-sync: func

    Writes the value to the output-stream synchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-sync: func

    +

    [method]incoming-value.incoming-value-consume-sync: func

    Consumes the value synchronously and returns the value as a list of bytes. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-async: func

    +

    [method]incoming-value.incoming-value-consume-async: func

    Consumes the value asynchronously and returns the value as an input-stream. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-size: func

    +

    [method]incoming-value.incoming-value-size: func

    The size of the value in bytes. If the size is unknown or unavailable, this function returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    Import interface wasi:keyvalue/eventual

    +

    Import interface wasi:keyvalue/eventual@0.1.0

    A keyvalue interface that provides eventually consistent CRUD operations.

    A CRUD operation is an operation that acts on a single key-value pair.

    The value in the key-value pair is defined as a u8 byte array and the intention @@ -609,24 +609,24 @@ if we pause the updates to the system, the system eventually will return the last updated value for read.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get: func

    +

    get: func

    Get the value associated with the key in the bucket.

    The value is returned as an option. If the key-value pair exists in the bucket, it returns Ok(value). If the key does not exist in the @@ -634,56 +634,56 @@ bucket, it returns Ok(none).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    set: func

    +

    set: func

    Set the value associated with the key in the bucket. If the key already exists in the bucket, it overwrites the value.

    If the key does not exist in the bucket, it creates a new key-value pair.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    delete: func

    +

    delete: func

    Delete the key-value pair associated with the key in the bucket.

    If the key does not exist in the bucket, it does nothing.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    exists: func

    +

    exists: func

    Check if the key exists in the bucket.

    If the key exists in the bucket, it returns Ok(true). If the key does not exist in the bucket, it returns Ok(false).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/atomic

    +

    Import interface wasi:keyvalue/atomic@0.1.0

    A keyvalue interface that provides atomic operations.

    Atomic operations are single, indivisible operations. When a fault causes an atomic operation to fail, it will appear to the invoker of the atomic @@ -691,18 +691,18 @@ operation that the action either completed successfully or did nothing at all.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    ----

    Functions

    -

    increment: func

    +

    increment: func

    Atomically increment the value associated with the key in the bucket by the given delta. It returns the new value.

    If the key does not exist in the bucket, it creates a new key-value pair @@ -710,15 +710,15 @@ with the value set to the given delta.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    compare-and-swap: func

    +

    compare-and-swap: func

    Compare-and-swap (CAS) atomically updates the value associated with the key in the bucket if the value matches the old value. This operation returns Ok(true) if the swap was successful, Ok(false) if the value did not match,

    @@ -728,16 +728,16 @@ and was replaced with the new value.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/eventual-batch

    +

    Import interface wasi:keyvalue/eventual-batch@0.1.0

    A keyvalue interface that provides eventually consistent batch operations.

    A batch operation is an operation that operates on multiple keys at once.

    Batch operations are useful for reducing network round-trip time. For example, @@ -757,24 +757,24 @@ meaning that if a write operation completes, subsequent read operations may not the value that was written.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get-many: func

    +

    get-many: func

    Get the values associated with the keys in the bucket. It returns a list of incoming-value that can be consumed to get the value associated with the key.

    If any of the keys do not exist in the bucket, it returns a none value for @@ -784,14 +784,14 @@ that key in the list.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    keys: func

    +

    keys: func

    Get all the keys in the bucket. It returns a list of keys.

    Note that the keys are not guaranteed to be returned in any particular order.

    If the bucket is empty, it returns an empty list.

    @@ -799,13 +799,13 @@ that key in the list.

    If any error occurs, it returns an Err(error).

    Params
    Return values
    -

    set-many: func

    +

    set-many: func

    Set the values associated with the keys in the bucket. If the key already exists in the bucket, it overwrites the value.

    Note that the key-value pairs are not guaranteed to be set in the order @@ -818,14 +818,14 @@ set while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
    -

    delete-many: func

    +

    delete-many: func

    Delete the key-value pairs associated with the keys in the bucket.

    Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.

    @@ -837,8 +837,8 @@ deleted while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
  • Exports:
  • -

    Import interface wasi:io/error@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/error@0.2.0-rc-2023-11-10


    Types

    -

    resource error

    +

    resource error

    A resource which represents some error information.

    The only method provided by this resource is to-debug-string, which provides some human-readable information about the error.

    @@ -38,7 +38,7 @@ error-code type, using the function

    The set of functions which can "downcast" an error into a more concrete type is open.

    Functions

    -

    [method]error.to-debug-string: func

    +

    [method]error.to-debug-string: func

    Returns a string that is suitable to assist humans in debugging this error.

    WARNING: The returned string should not be consumed mechanically! @@ -47,41 +47,41 @@ details. Parsing this string is a major platform-compatibility hazard.

    Params
    Return values
    • string
    -

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    A poll API intended to let users wait for I/O events on multiple handles at once.


    Types

    -

    resource pollable

    +

    resource pollable

    pollable epresents a single I/O event which may be ready, or not.

    Functions

    -

    [method]pollable.ready: func

    +

    [method]pollable.ready: func

    Return the readiness of a pollable. This function never blocks.

    Returns true when the pollable is ready, and false otherwise.

    Params
    Return values
    • bool
    -

    [method]pollable.block: func

    +

    [method]pollable.block: func

    block returns immediately if the pollable is ready, and otherwise blocks until ready.

    This function is equivalent to calling poll.poll on a list containing only this pollable.

    Params
    -

    poll: func

    +

    poll: func

    Poll for completion on a set of pollables.

    This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

    @@ -97,42 +97,42 @@ the pollables has an error, it is indicated by marking the source as being reaedy for I/O.

    Params
    Return values
    • list<u32>
    -

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    WASI I/O is an I/O abstraction API which is currently focused on providing stream types.

    In the future, the component model is expected to add built-in stream types; when it does, they are expected to subsume this API.


    Types

    -

    type error

    +

    type error

    error

    -#### `type pollable` +#### `type pollable` [`pollable`](#pollable)

    -#### `variant stream-error` +#### `variant stream-error`

    An error for input-stream and output-stream operations.

    Variant Cases
    • -

      last-operation-failed: own<error>

      +

      last-operation-failed: own<error>

      The last operation (a write or flush) failed before completion.

      More information is available in the error payload.

    • -

      closed

      +

      closed

      The stream is closed: no more input will be accepted by the stream. A closed output-stream will return this error on all future operations.

    -

    resource input-stream

    +

    resource input-stream

    An input bytestream.

    input-streams are non-blocking to the extent practical on underlying platforms. I/O operations always return promptly; if fewer bytes are @@ -140,7 +140,7 @@ promptly available than requested, they return the number of bytes promptly available, which could even be zero. To wait for data to be available, use the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    -

    resource output-stream

    +

    resource output-stream

    An output bytestream.

    output-streams are non-blocking to the extent practical on underlying platforms. Except where specified otherwise, I/O operations also @@ -149,7 +149,7 @@ promptly, which could even be zero. To wait for the stream to be ready to accept data, the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    Functions

    -

    [method]input-stream.read: func

    +

    [method]input-stream.read: func

    Perform a non-blocking read from the stream.

    This function returns a list of bytes containing the read data, when successful. The returned list will contain up to len bytes; @@ -169,51 +169,51 @@ as a return value by the callee. The callee may return a list of bytes less than len in size while more bytes are available for reading.

    Params
    Return values
    -

    [method]input-stream.blocking-read: func

    +

    [method]input-stream.blocking-read: func

    Read bytes from a stream, after blocking until at least one byte can be read. Except for blocking, behavior is identical to read.

    Params
    Return values
    -

    [method]input-stream.skip: func

    +

    [method]input-stream.skip: func

    Skip bytes from a stream. Returns number of bytes skipped.

    Behaves identical to read, except instead of returning a list of bytes, returns the number of bytes consumed from the stream.

    Params
    Return values
    -

    [method]input-stream.blocking-skip: func

    +

    [method]input-stream.blocking-skip: func

    Skip bytes from a stream, after blocking until at least one byte can be skipped. Except for blocking behavior, identical to skip.

    Params
    Return values
    -

    [method]input-stream.subscribe: func

    +

    [method]input-stream.subscribe: func

    Create a pollable which will resolve once either the specified stream has bytes available to read or the other end of the stream has been closed. @@ -222,13 +222,13 @@ Implementations may trap if the input-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.check-write: func

    +

    [method]output-stream.check-write: func

    Check readiness for writing. This function never blocks.

    Returns the number of bytes permitted for the next call to write, or an error. Calling write with more bytes than this function has @@ -238,13 +238,13 @@ become ready when this function will report at least 1 byte, or an error.

    Params
    Return values
    -

    [method]output-stream.write: func

    +

    [method]output-stream.write: func

    Perform a write. This function never blocks.

    Precondition: check-write gave permit of Ok(n) and contents has a length of less than or equal to n. Otherwise, this function will trap.

    @@ -252,14 +252,14 @@ length of less than or equal to n. Otherwise, this function will trap.

    the last call to check-write provided a permit.

    Params
    Return values
    -

    [method]output-stream.blocking-write-and-flush: func

    +

    [method]output-stream.blocking-write-and-flush: func

    Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    This is a convenience wrapper around the use of check-write, @@ -283,14 +283,14 @@ let _ = this.check-write(); // eliding error handling

    Params
    Return values
    -

    [method]output-stream.flush: func

    +

    [method]output-stream.flush: func

    Request to flush buffered output. This function never blocks.

    This tells the output-stream that the caller intends any buffered output to be flushed. the output which is expected to be flushed @@ -301,24 +301,24 @@ completed. The subscribe pollable will become ready when the flush has completed and the stream can accept more writes.

    Params
    Return values
    -

    [method]output-stream.blocking-flush: func

    +

    [method]output-stream.blocking-flush: func

    Request to flush buffered output, and block until flush completes and stream is ready for writing again.

    Params
    Return values
    -

    [method]output-stream.subscribe: func

    +

    [method]output-stream.subscribe: func

    Create a pollable which will resolve once the output-stream is ready for more writing, or an error has occured. When this pollable is ready, check-write will return ok(n) with n>0, or an @@ -329,13 +329,13 @@ Implementations may trap if the output-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.write-zeroes: func

    +

    [method]output-stream.write-zeroes: func

    Write zeroes to a stream.

    this should be used precisely like write with the exact same preconditions (must use check-write first), but instead of @@ -343,14 +343,14 @@ passing a list of bytes, you simply pass the number of zero-bytes that should be written.

    Params
    Return values
    -

    [method]output-stream.blocking-write-zeroes-and-flush: func

    +

    [method]output-stream.blocking-write-zeroes-and-flush: func

    Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    @@ -374,14 +374,14 @@ let _ = this.check-write(); // eliding error handling
    Params
    Return values
    -

    [method]output-stream.splice: func

    +

    [method]output-stream.splice: func

    Read from one stream and write to another.

    The behavior of splice is equivelant to:

      @@ -396,33 +396,33 @@ let _ = this.check-write(); // eliding error handling than len.

      Params
      Return values
      -

      [method]output-stream.blocking-splice: func

      +

      [method]output-stream.blocking-splice: func

      Read from one stream and write to another, with blocking.

      This is similar to splice, except that it blocks until the output-stream is ready for writing, and the input-stream is ready for reading, before performing the splice.

      Params
      Return values
      -

      Import interface wasi:keyvalue/wasi-keyvalue-error

      +

      Import interface wasi:keyvalue/wasi-keyvalue-error@0.1.0


      Types

      -

      resource error

      +

      resource error

      An error resource type for keyvalue operations.

      Common errors:

        @@ -439,29 +439,29 @@ of the error. In the future, this will be extended to provide more information about the error. Soon: switch to resource error { ... }

        Functions

        -

        [method]error.trace: func

        +

        [method]error.trace: func

        Params
        Return values
        • string
        -

        Import interface wasi:keyvalue/types

        +

        Import interface wasi:keyvalue/types@0.1.0

        A generic keyvalue interface for WASI.


        Types

        -

        type input-stream

        +

        type input-stream

        input-stream

        -#### `type output-stream` +#### `type output-stream` [`output-stream`](#output_stream)

        -#### `type error` +#### `type error` [`error`](#error)

        -#### `resource bucket` +#### `resource bucket`

        A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the bucket, and the bucket itself acts as a collection of all these entries.

        @@ -478,22 +478,22 @@ can very depending on the specific implementation. For example,

    In this interface, we use the term bucket to refer to a collection of key-value Soon: switch to resource bucket { ... }

    -

    type key

    +

    type key

    string

    A key is a unique identifier for a value in a bucket. The key is used to retrieve the value from the bucket. -

    resource outgoing-value

    +

    resource outgoing-value

    A value is the data stored in a key-value pair. The value can be of any type that can be represented in a byte array. It provides a way to write the value to the output-stream defined in the wasi-io interface. Soon: switch to resource value { ... }

    -

    type outgoing-value-body-async

    +

    type outgoing-value-body-async

    output-stream

    -#### `type outgoing-value-body-sync` +#### `type outgoing-value-body-sync` [`outgoing-value-body-sync`](#outgoing_value_body_sync)

    -#### `resource incoming-value` +#### `resource incoming-value`

    A incoming-value is a wrapper around a value. It provides a way to read the value from the input-stream defined in the wasi-io interface.

    The incoming-value provides two ways to consume the value:

    @@ -507,87 +507,87 @@ This is useful when the value is large and the caller wants to allocate a buffer the right size to consume the value. Soon: switch to resource incoming-value { ... } -

    type incoming-value-async-body

    +

    type incoming-value-async-body

    input-stream

    -#### `type incoming-value-sync-body` +#### `type incoming-value-sync-body` [`incoming-value-sync-body`](#incoming_value_sync_body)

    ----

    Functions

    -

    [static]bucket.open-bucket: func

    +

    [static]bucket.open-bucket: func

    Opens a bucket with the given name.

    If any error occurs, including if the bucket does not exist, it returns an Err(error).

    Params
      -
    • name: string
    • +
    • name: string
    Return values
    -

    [static]outgoing-value.new-outgoing-value: func

    +

    [static]outgoing-value.new-outgoing-value: func

    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-async: func

    +

    [method]outgoing-value.outgoing-value-write-body-async: func

    Writes the value to the output-stream asynchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-sync: func

    +

    [method]outgoing-value.outgoing-value-write-body-sync: func

    Writes the value to the output-stream synchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-sync: func

    +

    [method]incoming-value.incoming-value-consume-sync: func

    Consumes the value synchronously and returns the value as a list of bytes. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-async: func

    +

    [method]incoming-value.incoming-value-consume-async: func

    Consumes the value asynchronously and returns the value as an input-stream. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-size: func

    +

    [method]incoming-value.incoming-value-size: func

    The size of the value in bytes. If the size is unknown or unavailable, this function returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    Import interface wasi:keyvalue/eventual

    +

    Import interface wasi:keyvalue/eventual@0.1.0

    A keyvalue interface that provides eventually consistent CRUD operations.

    A CRUD operation is an operation that acts on a single key-value pair.

    The value in the key-value pair is defined as a u8 byte array and the intention @@ -606,24 +606,24 @@ if we pause the updates to the system, the system eventually will return the last updated value for read.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get: func

    +

    get: func

    Get the value associated with the key in the bucket.

    The value is returned as an option. If the key-value pair exists in the bucket, it returns Ok(value). If the key does not exist in the @@ -631,56 +631,56 @@ bucket, it returns Ok(none).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    set: func

    +

    set: func

    Set the value associated with the key in the bucket. If the key already exists in the bucket, it overwrites the value.

    If the key does not exist in the bucket, it creates a new key-value pair.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    delete: func

    +

    delete: func

    Delete the key-value pair associated with the key in the bucket.

    If the key does not exist in the bucket, it does nothing.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    exists: func

    +

    exists: func

    Check if the key exists in the bucket.

    If the key exists in the bucket, it returns Ok(true). If the key does not exist in the bucket, it returns Ok(false).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/atomic

    +

    Import interface wasi:keyvalue/atomic@0.1.0

    A keyvalue interface that provides atomic operations.

    Atomic operations are single, indivisible operations. When a fault causes an atomic operation to fail, it will appear to the invoker of the atomic @@ -688,18 +688,18 @@ operation that the action either completed successfully or did nothing at all.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    ----

    Functions

    -

    increment: func

    +

    increment: func

    Atomically increment the value associated with the key in the bucket by the given delta. It returns the new value.

    If the key does not exist in the bucket, it creates a new key-value pair @@ -707,15 +707,15 @@ with the value set to the given delta.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    compare-and-swap: func

    +

    compare-and-swap: func

    Compare-and-swap (CAS) atomically updates the value associated with the key in the bucket if the value matches the old value. This operation returns Ok(true) if the swap was successful, Ok(false) if the value did not match,

    @@ -725,16 +725,16 @@ and was replaced with the new value.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/eventual-batch

    +

    Import interface wasi:keyvalue/eventual-batch@0.1.0

    A keyvalue interface that provides eventually consistent batch operations.

    A batch operation is an operation that operates on multiple keys at once.

    Batch operations are useful for reducing network round-trip time. For example, @@ -754,24 +754,24 @@ meaning that if a write operation completes, subsequent read operations may not the value that was written.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get-many: func

    +

    get-many: func

    Get the values associated with the keys in the bucket. It returns a list of incoming-value that can be consumed to get the value associated with the key.

    If any of the keys do not exist in the bucket, it returns a none value for @@ -781,14 +781,14 @@ that key in the list.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    keys: func

    +

    keys: func

    Get all the keys in the bucket. It returns a list of keys.

    Note that the keys are not guaranteed to be returned in any particular order.

    If the bucket is empty, it returns an empty list.

    @@ -796,13 +796,13 @@ that key in the list.

    If any error occurs, it returns an Err(error).

    Params
    Return values
    -

    set-many: func

    +

    set-many: func

    Set the values associated with the keys in the bucket. If the key already exists in the bucket, it overwrites the value.

    Note that the key-value pairs are not guaranteed to be set in the order @@ -815,14 +815,14 @@ set while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
    -

    delete-many: func

    +

    delete-many: func

    Delete the key-value pairs associated with the keys in the bucket.

    Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.

    @@ -834,42 +834,42 @@ deleted while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
    -

    Export interface wasi:keyvalue/handle-watch

    +

    Export interface wasi:keyvalue/handle-watch@0.1.0


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    ----

    Functions

    -

    on-set: func

    +

    on-set: func

    Handle the set event for the given bucket and key. It returns a incoming-value that represents the new value being set. The new value can be consumed by the handler.

    Params
    -

    on-delete: func

    +

    on-delete: func

    Handle the delete event for the given bucket and key. It returns a key that represents the key being deleted.

    Params
    From 39a7382e6c1f9bd39c472cfc92bf89378a9f6457 Mon Sep 17 00:00:00 2001 From: "Jiaxiao Zhou (Mossaka)" Date: Wed, 24 Jan 2024 16:33:20 -0800 Subject: [PATCH 3/3] chore(*): update the markdown files Signed-off-by: Jiaxiao Zhou (Mossaka) --- imports.md | 282 ++++++++++++++++++------------------ keyvalue-handle-watch.md | 304 +++++++++++++++++++-------------------- 2 files changed, 293 insertions(+), 293 deletions(-) diff --git a/imports.md b/imports.md index 812bf03..91fe0bc 100644 --- a/imports.md +++ b/imports.md @@ -21,10 +21,10 @@ do

    -

    Import interface wasi:io/error@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/error@0.2.0-rc-2023-11-10


    Types

    -

    resource error

    +

    resource error

    A resource which represents some error information.

    The only method provided by this resource is to-debug-string, which provides some human-readable information about the error.

    @@ -41,7 +41,7 @@ error-code type, using the function

    The set of functions which can "downcast" an error into a more concrete type is open.

    Functions

    -

    [method]error.to-debug-string: func

    +

    [method]error.to-debug-string: func

    Returns a string that is suitable to assist humans in debugging this error.

    WARNING: The returned string should not be consumed mechanically! @@ -50,41 +50,41 @@ details. Parsing this string is a major platform-compatibility hazard.

    Params
    Return values
    • string
    -

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    A poll API intended to let users wait for I/O events on multiple handles at once.


    Types

    -

    resource pollable

    +

    resource pollable

    pollable epresents a single I/O event which may be ready, or not.

    Functions

    -

    [method]pollable.ready: func

    +

    [method]pollable.ready: func

    Return the readiness of a pollable. This function never blocks.

    Returns true when the pollable is ready, and false otherwise.

    Params
    Return values
    • bool
    -

    [method]pollable.block: func

    +

    [method]pollable.block: func

    block returns immediately if the pollable is ready, and otherwise blocks until ready.

    This function is equivalent to calling poll.poll on a list containing only this pollable.

    Params
    -

    poll: func

    +

    poll: func

    Poll for completion on a set of pollables.

    This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

    @@ -100,42 +100,42 @@ the pollables has an error, it is indicated by marking the source as being reaedy for I/O.

    Params
    Return values
    • list<u32>
    -

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    WASI I/O is an I/O abstraction API which is currently focused on providing stream types.

    In the future, the component model is expected to add built-in stream types; when it does, they are expected to subsume this API.


    Types

    -

    type error

    +

    type error

    error

    -#### `type pollable` +#### `type pollable` [`pollable`](#pollable)

    -#### `variant stream-error` +#### `variant stream-error`

    An error for input-stream and output-stream operations.

    Variant Cases
    • -

      last-operation-failed: own<error>

      +

      last-operation-failed: own<error>

      The last operation (a write or flush) failed before completion.

      More information is available in the error payload.

    • -

      closed

      +

      closed

      The stream is closed: no more input will be accepted by the stream. A closed output-stream will return this error on all future operations.

    -

    resource input-stream

    +

    resource input-stream

    An input bytestream.

    input-streams are non-blocking to the extent practical on underlying platforms. I/O operations always return promptly; if fewer bytes are @@ -143,7 +143,7 @@ promptly available than requested, they return the number of bytes promptly available, which could even be zero. To wait for data to be available, use the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    -

    resource output-stream

    +

    resource output-stream

    An output bytestream.

    output-streams are non-blocking to the extent practical on underlying platforms. Except where specified otherwise, I/O operations also @@ -152,7 +152,7 @@ promptly, which could even be zero. To wait for the stream to be ready to accept data, the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    Functions

    -

    [method]input-stream.read: func

    +

    [method]input-stream.read: func

    Perform a non-blocking read from the stream.

    This function returns a list of bytes containing the read data, when successful. The returned list will contain up to len bytes; @@ -172,51 +172,51 @@ as a return value by the callee. The callee may return a list of bytes less than len in size while more bytes are available for reading.

    Params
    Return values
    -

    [method]input-stream.blocking-read: func

    +

    [method]input-stream.blocking-read: func

    Read bytes from a stream, after blocking until at least one byte can be read. Except for blocking, behavior is identical to read.

    Params
    Return values
    -

    [method]input-stream.skip: func

    +

    [method]input-stream.skip: func

    Skip bytes from a stream. Returns number of bytes skipped.

    Behaves identical to read, except instead of returning a list of bytes, returns the number of bytes consumed from the stream.

    Params
    Return values
    -

    [method]input-stream.blocking-skip: func

    +

    [method]input-stream.blocking-skip: func

    Skip bytes from a stream, after blocking until at least one byte can be skipped. Except for blocking behavior, identical to skip.

    Params
    Return values
    -

    [method]input-stream.subscribe: func

    +

    [method]input-stream.subscribe: func

    Create a pollable which will resolve once either the specified stream has bytes available to read or the other end of the stream has been closed. @@ -225,13 +225,13 @@ Implementations may trap if the input-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.check-write: func

    +

    [method]output-stream.check-write: func

    Check readiness for writing. This function never blocks.

    Returns the number of bytes permitted for the next call to write, or an error. Calling write with more bytes than this function has @@ -241,13 +241,13 @@ become ready when this function will report at least 1 byte, or an error.

    Params
    Return values
    -

    [method]output-stream.write: func

    +

    [method]output-stream.write: func

    Perform a write. This function never blocks.

    Precondition: check-write gave permit of Ok(n) and contents has a length of less than or equal to n. Otherwise, this function will trap.

    @@ -255,14 +255,14 @@ length of less than or equal to n. Otherwise, this function will trap.

    the last call to check-write provided a permit.

    Params
    Return values
    -

    [method]output-stream.blocking-write-and-flush: func

    +

    [method]output-stream.blocking-write-and-flush: func

    Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    This is a convenience wrapper around the use of check-write, @@ -286,14 +286,14 @@ let _ = this.check-write(); // eliding error handling

    Params
    Return values
    -

    [method]output-stream.flush: func

    +

    [method]output-stream.flush: func

    Request to flush buffered output. This function never blocks.

    This tells the output-stream that the caller intends any buffered output to be flushed. the output which is expected to be flushed @@ -304,24 +304,24 @@ completed. The subscribe pollable will become ready when the flush has completed and the stream can accept more writes.

    Params
    Return values
    -

    [method]output-stream.blocking-flush: func

    +

    [method]output-stream.blocking-flush: func

    Request to flush buffered output, and block until flush completes and stream is ready for writing again.

    Params
    Return values
    -

    [method]output-stream.subscribe: func

    +

    [method]output-stream.subscribe: func

    Create a pollable which will resolve once the output-stream is ready for more writing, or an error has occured. When this pollable is ready, check-write will return ok(n) with n>0, or an @@ -332,13 +332,13 @@ Implementations may trap if the output-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.write-zeroes: func

    +

    [method]output-stream.write-zeroes: func

    Write zeroes to a stream.

    this should be used precisely like write with the exact same preconditions (must use check-write first), but instead of @@ -346,14 +346,14 @@ passing a list of bytes, you simply pass the number of zero-bytes that should be written.

    Params
    Return values
    -

    [method]output-stream.blocking-write-zeroes-and-flush: func

    +

    [method]output-stream.blocking-write-zeroes-and-flush: func

    Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    @@ -377,14 +377,14 @@ let _ = this.check-write(); // eliding error handling
    Params
    Return values
    -

    [method]output-stream.splice: func

    +

    [method]output-stream.splice: func

    Read from one stream and write to another.

    The behavior of splice is equivelant to:

      @@ -399,33 +399,33 @@ let _ = this.check-write(); // eliding error handling than len.

      Params
      Return values
      -

      [method]output-stream.blocking-splice: func

      +

      [method]output-stream.blocking-splice: func

      Read from one stream and write to another, with blocking.

      This is similar to splice, except that it blocks until the output-stream is ready for writing, and the input-stream is ready for reading, before performing the splice.

      Params
      Return values
      -

      Import interface wasi:keyvalue/wasi-keyvalue-error@0.1.0

      +

      Import interface wasi:keyvalue/wasi-keyvalue-error@0.1.0


      Types

      -

      resource error

      +

      resource error

      An error resource type for keyvalue operations.

      Common errors:

        @@ -442,29 +442,29 @@ of the error. In the future, this will be extended to provide more information about the error. Soon: switch to resource error { ... }

        Functions

        -

        [method]error.trace: func

        +

        [method]error.trace: func

        Params
        Return values
        • string
        -

        Import interface wasi:keyvalue/types@0.1.0

        +

        Import interface wasi:keyvalue/types@0.1.0

        A generic keyvalue interface for WASI.


        Types

        -

        type input-stream

        +

        type input-stream

        input-stream

        -#### `type output-stream` +#### `type output-stream` [`output-stream`](#output_stream)

        -#### `type error` +#### `type error` [`error`](#error)

        -#### `resource bucket` +#### `resource bucket`

        A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the bucket, and the bucket itself acts as a collection of all these entries.

        @@ -481,22 +481,22 @@ can very depending on the specific implementation. For example,

    In this interface, we use the term bucket to refer to a collection of key-value Soon: switch to resource bucket { ... }

    -

    type key

    +

    type key

    string

    A key is a unique identifier for a value in a bucket. The key is used to retrieve the value from the bucket. -

    resource outgoing-value

    +

    resource outgoing-value

    A value is the data stored in a key-value pair. The value can be of any type that can be represented in a byte array. It provides a way to write the value to the output-stream defined in the wasi-io interface. Soon: switch to resource value { ... }

    -

    type outgoing-value-body-async

    +

    type outgoing-value-body-async

    output-stream

    -#### `type outgoing-value-body-sync` +#### `type outgoing-value-body-sync` [`outgoing-value-body-sync`](#outgoing_value_body_sync)

    -#### `resource incoming-value` +#### `resource incoming-value`

    A incoming-value is a wrapper around a value. It provides a way to read the value from the input-stream defined in the wasi-io interface.

    The incoming-value provides two ways to consume the value:

    @@ -510,87 +510,87 @@ This is useful when the value is large and the caller wants to allocate a buffer the right size to consume the value. Soon: switch to resource incoming-value { ... } -

    type incoming-value-async-body

    +

    type incoming-value-async-body

    input-stream

    -#### `type incoming-value-sync-body` +#### `type incoming-value-sync-body` [`incoming-value-sync-body`](#incoming_value_sync_body)

    ----

    Functions

    -

    [static]bucket.open-bucket: func

    +

    [static]bucket.open-bucket: func

    Opens a bucket with the given name.

    If any error occurs, including if the bucket does not exist, it returns an Err(error).

    Params
      -
    • name: string
    • +
    • name: string
    Return values
    -

    [static]outgoing-value.new-outgoing-value: func

    +

    [static]outgoing-value.new-outgoing-value: func

    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-async: func

    +

    [method]outgoing-value.outgoing-value-write-body-async: func

    Writes the value to the output-stream asynchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-sync: func

    +

    [method]outgoing-value.outgoing-value-write-body-sync: func

    Writes the value to the output-stream synchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-sync: func

    +

    [method]incoming-value.incoming-value-consume-sync: func

    Consumes the value synchronously and returns the value as a list of bytes. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-async: func

    +

    [method]incoming-value.incoming-value-consume-async: func

    Consumes the value asynchronously and returns the value as an input-stream. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-size: func

    +

    [method]incoming-value.incoming-value-size: func

    The size of the value in bytes. If the size is unknown or unavailable, this function returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    Import interface wasi:keyvalue/eventual@0.1.0

    +

    Import interface wasi:keyvalue/eventual@0.1.0

    A keyvalue interface that provides eventually consistent CRUD operations.

    A CRUD operation is an operation that acts on a single key-value pair.

    The value in the key-value pair is defined as a u8 byte array and the intention @@ -609,24 +609,24 @@ if we pause the updates to the system, the system eventually will return the last updated value for read.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get: func

    +

    get: func

    Get the value associated with the key in the bucket.

    The value is returned as an option. If the key-value pair exists in the bucket, it returns Ok(value). If the key does not exist in the @@ -634,56 +634,56 @@ bucket, it returns Ok(none).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    set: func

    +

    set: func

    Set the value associated with the key in the bucket. If the key already exists in the bucket, it overwrites the value.

    If the key does not exist in the bucket, it creates a new key-value pair.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    delete: func

    +

    delete: func

    Delete the key-value pair associated with the key in the bucket.

    If the key does not exist in the bucket, it does nothing.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    exists: func

    +

    exists: func

    Check if the key exists in the bucket.

    If the key exists in the bucket, it returns Ok(true). If the key does not exist in the bucket, it returns Ok(false).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/atomic@0.1.0

    +

    Import interface wasi:keyvalue/atomic@0.1.0

    A keyvalue interface that provides atomic operations.

    Atomic operations are single, indivisible operations. When a fault causes an atomic operation to fail, it will appear to the invoker of the atomic @@ -691,18 +691,18 @@ operation that the action either completed successfully or did nothing at all.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    ----

    Functions

    -

    increment: func

    +

    increment: func

    Atomically increment the value associated with the key in the bucket by the given delta. It returns the new value.

    If the key does not exist in the bucket, it creates a new key-value pair @@ -710,15 +710,15 @@ with the value set to the given delta.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    compare-and-swap: func

    +

    compare-and-swap: func

    Compare-and-swap (CAS) atomically updates the value associated with the key in the bucket if the value matches the old value. This operation returns Ok(true) if the swap was successful, Ok(false) if the value did not match,

    @@ -728,16 +728,16 @@ and was replaced with the new value.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/eventual-batch@0.1.0

    +

    Import interface wasi:keyvalue/eventual-batch@0.1.0

    A keyvalue interface that provides eventually consistent batch operations.

    A batch operation is an operation that operates on multiple keys at once.

    Batch operations are useful for reducing network round-trip time. For example, @@ -757,24 +757,24 @@ meaning that if a write operation completes, subsequent read operations may not the value that was written.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get-many: func

    +

    get-many: func

    Get the values associated with the keys in the bucket. It returns a list of incoming-value that can be consumed to get the value associated with the key.

    If any of the keys do not exist in the bucket, it returns a none value for @@ -784,14 +784,14 @@ that key in the list.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    keys: func

    +

    keys: func

    Get all the keys in the bucket. It returns a list of keys.

    Note that the keys are not guaranteed to be returned in any particular order.

    If the bucket is empty, it returns an empty list.

    @@ -799,13 +799,13 @@ that key in the list.

    If any error occurs, it returns an Err(error).

    Params
    Return values
    -

    set-many: func

    +

    set-many: func

    Set the values associated with the keys in the bucket. If the key already exists in the bucket, it overwrites the value.

    Note that the key-value pairs are not guaranteed to be set in the order @@ -818,14 +818,14 @@ set while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
    -

    delete-many: func

    +

    delete-many: func

    Delete the key-value pairs associated with the keys in the bucket.

    Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.

    @@ -837,8 +837,8 @@ deleted while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
      diff --git a/keyvalue-handle-watch.md b/keyvalue-handle-watch.md index 280e5ee..0c712b8 100644 --- a/keyvalue-handle-watch.md +++ b/keyvalue-handle-watch.md @@ -18,10 +18,10 @@
    -

    Import interface wasi:io/error@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/error@0.2.0-rc-2023-11-10


    Types

    -

    resource error

    +

    resource error

    A resource which represents some error information.

    The only method provided by this resource is to-debug-string, which provides some human-readable information about the error.

    @@ -38,7 +38,7 @@ error-code type, using the function

    The set of functions which can "downcast" an error into a more concrete type is open.

    Functions

    -

    [method]error.to-debug-string: func

    +

    [method]error.to-debug-string: func

    Returns a string that is suitable to assist humans in debugging this error.

    WARNING: The returned string should not be consumed mechanically! @@ -47,41 +47,41 @@ details. Parsing this string is a major platform-compatibility hazard.

    Params
    Return values
    • string
    -

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/poll@0.2.0-rc-2023-11-10

    A poll API intended to let users wait for I/O events on multiple handles at once.


    Types

    -

    resource pollable

    +

    resource pollable

    pollable epresents a single I/O event which may be ready, or not.

    Functions

    -

    [method]pollable.ready: func

    +

    [method]pollable.ready: func

    Return the readiness of a pollable. This function never blocks.

    Returns true when the pollable is ready, and false otherwise.

    Params
    Return values
    • bool
    -

    [method]pollable.block: func

    +

    [method]pollable.block: func

    block returns immediately if the pollable is ready, and otherwise blocks until ready.

    This function is equivalent to calling poll.poll on a list containing only this pollable.

    Params
    -

    poll: func

    +

    poll: func

    Poll for completion on a set of pollables.

    This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

    @@ -97,42 +97,42 @@ the pollables has an error, it is indicated by marking the source as being reaedy for I/O.

    Params
    Return values
    • list<u32>
    -

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    +

    Import interface wasi:io/streams@0.2.0-rc-2023-11-10

    WASI I/O is an I/O abstraction API which is currently focused on providing stream types.

    In the future, the component model is expected to add built-in stream types; when it does, they are expected to subsume this API.


    Types

    -

    type error

    +

    type error

    error

    -#### `type pollable` +#### `type pollable` [`pollable`](#pollable)

    -#### `variant stream-error` +#### `variant stream-error`

    An error for input-stream and output-stream operations.

    Variant Cases
    • -

      last-operation-failed: own<error>

      +

      last-operation-failed: own<error>

      The last operation (a write or flush) failed before completion.

      More information is available in the error payload.

    • -

      closed

      +

      closed

      The stream is closed: no more input will be accepted by the stream. A closed output-stream will return this error on all future operations.

    -

    resource input-stream

    +

    resource input-stream

    An input bytestream.

    input-streams are non-blocking to the extent practical on underlying platforms. I/O operations always return promptly; if fewer bytes are @@ -140,7 +140,7 @@ promptly available than requested, they return the number of bytes promptly available, which could even be zero. To wait for data to be available, use the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    -

    resource output-stream

    +

    resource output-stream

    An output bytestream.

    output-streams are non-blocking to the extent practical on underlying platforms. Except where specified otherwise, I/O operations also @@ -149,7 +149,7 @@ promptly, which could even be zero. To wait for the stream to be ready to accept data, the subscribe function to obtain a pollable which can be polled for using wasi:io/poll.

    Functions

    -

    [method]input-stream.read: func

    +

    [method]input-stream.read: func

    Perform a non-blocking read from the stream.

    This function returns a list of bytes containing the read data, when successful. The returned list will contain up to len bytes; @@ -169,51 +169,51 @@ as a return value by the callee. The callee may return a list of bytes less than len in size while more bytes are available for reading.

    Params
    Return values
    -

    [method]input-stream.blocking-read: func

    +

    [method]input-stream.blocking-read: func

    Read bytes from a stream, after blocking until at least one byte can be read. Except for blocking, behavior is identical to read.

    Params
    Return values
    -

    [method]input-stream.skip: func

    +

    [method]input-stream.skip: func

    Skip bytes from a stream. Returns number of bytes skipped.

    Behaves identical to read, except instead of returning a list of bytes, returns the number of bytes consumed from the stream.

    Params
    Return values
    -

    [method]input-stream.blocking-skip: func

    +

    [method]input-stream.blocking-skip: func

    Skip bytes from a stream, after blocking until at least one byte can be skipped. Except for blocking behavior, identical to skip.

    Params
    Return values
    -

    [method]input-stream.subscribe: func

    +

    [method]input-stream.subscribe: func

    Create a pollable which will resolve once either the specified stream has bytes available to read or the other end of the stream has been closed. @@ -222,13 +222,13 @@ Implementations may trap if the input-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.check-write: func

    +

    [method]output-stream.check-write: func

    Check readiness for writing. This function never blocks.

    Returns the number of bytes permitted for the next call to write, or an error. Calling write with more bytes than this function has @@ -238,13 +238,13 @@ become ready when this function will report at least 1 byte, or an error.

    Params
    Return values
    -

    [method]output-stream.write: func

    +

    [method]output-stream.write: func

    Perform a write. This function never blocks.

    Precondition: check-write gave permit of Ok(n) and contents has a length of less than or equal to n. Otherwise, this function will trap.

    @@ -252,14 +252,14 @@ length of less than or equal to n. Otherwise, this function will trap.

    the last call to check-write provided a permit.

    Params
    Return values
    -

    [method]output-stream.blocking-write-and-flush: func

    +

    [method]output-stream.blocking-write-and-flush: func

    Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    This is a convenience wrapper around the use of check-write, @@ -283,14 +283,14 @@ let _ = this.check-write(); // eliding error handling

    Params
    Return values
    -

    [method]output-stream.flush: func

    +

    [method]output-stream.flush: func

    Request to flush buffered output. This function never blocks.

    This tells the output-stream that the caller intends any buffered output to be flushed. the output which is expected to be flushed @@ -301,24 +301,24 @@ completed. The subscribe pollable will become ready when the flush has completed and the stream can accept more writes.

    Params
    Return values
    -

    [method]output-stream.blocking-flush: func

    +

    [method]output-stream.blocking-flush: func

    Request to flush buffered output, and block until flush completes and stream is ready for writing again.

    Params
    Return values
    -

    [method]output-stream.subscribe: func

    +

    [method]output-stream.subscribe: func

    Create a pollable which will resolve once the output-stream is ready for more writing, or an error has occured. When this pollable is ready, check-write will return ok(n) with n>0, or an @@ -329,13 +329,13 @@ Implementations may trap if the output-streampollables created with this function are dropped.

    Params
    Return values
    -

    [method]output-stream.write-zeroes: func

    +

    [method]output-stream.write-zeroes: func

    Write zeroes to a stream.

    this should be used precisely like write with the exact same preconditions (must use check-write first), but instead of @@ -343,14 +343,14 @@ passing a list of bytes, you simply pass the number of zero-bytes that should be written.

    Params
    Return values
    -

    [method]output-stream.blocking-write-zeroes-and-flush: func

    +

    [method]output-stream.blocking-write-zeroes-and-flush: func

    Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

    @@ -374,14 +374,14 @@ let _ = this.check-write(); // eliding error handling
    Params
    Return values
    -

    [method]output-stream.splice: func

    +

    [method]output-stream.splice: func

    Read from one stream and write to another.

    The behavior of splice is equivelant to:

      @@ -396,33 +396,33 @@ let _ = this.check-write(); // eliding error handling than len.

      Params
      Return values
      -

      [method]output-stream.blocking-splice: func

      +

      [method]output-stream.blocking-splice: func

      Read from one stream and write to another, with blocking.

      This is similar to splice, except that it blocks until the output-stream is ready for writing, and the input-stream is ready for reading, before performing the splice.

      Params
      Return values
      -

      Import interface wasi:keyvalue/wasi-keyvalue-error@0.1.0

      +

      Import interface wasi:keyvalue/wasi-keyvalue-error@0.1.0


      Types

      -

      resource error

      +

      resource error

      An error resource type for keyvalue operations.

      Common errors:

        @@ -439,29 +439,29 @@ of the error. In the future, this will be extended to provide more information about the error. Soon: switch to resource error { ... }

        Functions

        -

        [method]error.trace: func

        +

        [method]error.trace: func

        Params
        Return values
        • string
        -

        Import interface wasi:keyvalue/types@0.1.0

        +

        Import interface wasi:keyvalue/types@0.1.0

        A generic keyvalue interface for WASI.


        Types

        -

        type input-stream

        +

        type input-stream

        input-stream

        -#### `type output-stream` +#### `type output-stream` [`output-stream`](#output_stream)

        -#### `type error` +#### `type error` [`error`](#error)

        -#### `resource bucket` +#### `resource bucket`

        A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the bucket, and the bucket itself acts as a collection of all these entries.

        @@ -478,22 +478,22 @@ can very depending on the specific implementation. For example,

    In this interface, we use the term bucket to refer to a collection of key-value Soon: switch to resource bucket { ... }

    -

    type key

    +

    type key

    string

    A key is a unique identifier for a value in a bucket. The key is used to retrieve the value from the bucket. -

    resource outgoing-value

    +

    resource outgoing-value

    A value is the data stored in a key-value pair. The value can be of any type that can be represented in a byte array. It provides a way to write the value to the output-stream defined in the wasi-io interface. Soon: switch to resource value { ... }

    -

    type outgoing-value-body-async

    +

    type outgoing-value-body-async

    output-stream

    -#### `type outgoing-value-body-sync` +#### `type outgoing-value-body-sync` [`outgoing-value-body-sync`](#outgoing_value_body_sync)

    -#### `resource incoming-value` +#### `resource incoming-value`

    A incoming-value is a wrapper around a value. It provides a way to read the value from the input-stream defined in the wasi-io interface.

    The incoming-value provides two ways to consume the value:

    @@ -507,87 +507,87 @@ This is useful when the value is large and the caller wants to allocate a buffer the right size to consume the value. Soon: switch to resource incoming-value { ... } -

    type incoming-value-async-body

    +

    type incoming-value-async-body

    input-stream

    -#### `type incoming-value-sync-body` +#### `type incoming-value-sync-body` [`incoming-value-sync-body`](#incoming_value_sync_body)

    ----

    Functions

    -

    [static]bucket.open-bucket: func

    +

    [static]bucket.open-bucket: func

    Opens a bucket with the given name.

    If any error occurs, including if the bucket does not exist, it returns an Err(error).

    Params
      -
    • name: string
    • +
    • name: string
    Return values
    -

    [static]outgoing-value.new-outgoing-value: func

    +

    [static]outgoing-value.new-outgoing-value: func

    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-async: func

    +

    [method]outgoing-value.outgoing-value-write-body-async: func

    Writes the value to the output-stream asynchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]outgoing-value.outgoing-value-write-body-sync: func

    +

    [method]outgoing-value.outgoing-value-write-body-sync: func

    Writes the value to the output-stream synchronously. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-sync: func

    +

    [method]incoming-value.incoming-value-consume-sync: func

    Consumes the value synchronously and returns the value as a list of bytes. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-consume-async: func

    +

    [method]incoming-value.incoming-value-consume-async: func

    Consumes the value asynchronously and returns the value as an input-stream. If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    [method]incoming-value.incoming-value-size: func

    +

    [method]incoming-value.incoming-value-size: func

    The size of the value in bytes. If the size is unknown or unavailable, this function returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    Import interface wasi:keyvalue/eventual@0.1.0

    +

    Import interface wasi:keyvalue/eventual@0.1.0

    A keyvalue interface that provides eventually consistent CRUD operations.

    A CRUD operation is an operation that acts on a single key-value pair.

    The value in the key-value pair is defined as a u8 byte array and the intention @@ -606,24 +606,24 @@ if we pause the updates to the system, the system eventually will return the last updated value for read.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get: func

    +

    get: func

    Get the value associated with the key in the bucket.

    The value is returned as an option. If the key-value pair exists in the bucket, it returns Ok(value). If the key does not exist in the @@ -631,56 +631,56 @@ bucket, it returns Ok(none).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    set: func

    +

    set: func

    Set the value associated with the key in the bucket. If the key already exists in the bucket, it overwrites the value.

    If the key does not exist in the bucket, it creates a new key-value pair.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    delete: func

    +

    delete: func

    Delete the key-value pair associated with the key in the bucket.

    If the key does not exist in the bucket, it does nothing.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    exists: func

    +

    exists: func

    Check if the key exists in the bucket.

    If the key exists in the bucket, it returns Ok(true). If the key does not exist in the bucket, it returns Ok(false).

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/atomic@0.1.0

    +

    Import interface wasi:keyvalue/atomic@0.1.0

    A keyvalue interface that provides atomic operations.

    Atomic operations are single, indivisible operations. When a fault causes an atomic operation to fail, it will appear to the invoker of the atomic @@ -688,18 +688,18 @@ operation that the action either completed successfully or did nothing at all.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    ----

    Functions

    -

    increment: func

    +

    increment: func

    Atomically increment the value associated with the key in the bucket by the given delta. It returns the new value.

    If the key does not exist in the bucket, it creates a new key-value pair @@ -707,15 +707,15 @@ with the value set to the given delta.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<u64, own<error>>
    -

    compare-and-swap: func

    +

    compare-and-swap: func

    Compare-and-swap (CAS) atomically updates the value associated with the key in the bucket if the value matches the old value. This operation returns Ok(true) if the swap was successful, Ok(false) if the value did not match,

    @@ -725,16 +725,16 @@ and was replaced with the new value.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    • result<bool, own<error>>
    -

    Import interface wasi:keyvalue/eventual-batch@0.1.0

    +

    Import interface wasi:keyvalue/eventual-batch@0.1.0

    A keyvalue interface that provides eventually consistent batch operations.

    A batch operation is an operation that operates on multiple keys at once.

    Batch operations are useful for reducing network round-trip time. For example, @@ -754,24 +754,24 @@ meaning that if a write operation completes, subsequent read operations may not the value that was written.


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type error` +#### `type error` [`error`](#error)

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    -#### `type outgoing-value` +#### `type outgoing-value` [`outgoing-value`](#outgoing_value)

    ----

    Functions

    -

    get-many: func

    +

    get-many: func

    Get the values associated with the keys in the bucket. It returns a list of incoming-value that can be consumed to get the value associated with the key.

    If any of the keys do not exist in the bucket, it returns a none value for @@ -781,14 +781,14 @@ that key in the list.

    If any other error occurs, it returns an Err(error).

    Params
    Return values
    -

    keys: func

    +

    keys: func

    Get all the keys in the bucket. It returns a list of keys.

    Note that the keys are not guaranteed to be returned in any particular order.

    If the bucket is empty, it returns an empty list.

    @@ -796,13 +796,13 @@ that key in the list.

    If any error occurs, it returns an Err(error).

    Params
    Return values
    -

    set-many: func

    +

    set-many: func

    Set the values associated with the keys in the bucket. If the key already exists in the bucket, it overwrites the value.

    Note that the key-value pairs are not guaranteed to be set in the order @@ -815,14 +815,14 @@ set while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
    -

    delete-many: func

    +

    delete-many: func

    Delete the key-value pairs associated with the keys in the bucket.

    Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.

    @@ -834,42 +834,42 @@ deleted while others might fail.

    Other concurrent operations may also be able to see the partial results.

    Params
    Return values
    -

    Export interface wasi:keyvalue/handle-watch@0.1.0

    +

    Export interface wasi:keyvalue/handle-watch@0.1.0


    Types

    -

    type bucket

    +

    type bucket

    bucket

    -#### `type key` +#### `type key` [`key`](#key)

    -#### `type incoming-value` +#### `type incoming-value` [`incoming-value`](#incoming_value)

    ----

    Functions

    -

    on-set: func

    +

    on-set: func

    Handle the set event for the given bucket and key. It returns a incoming-value that represents the new value being set. The new value can be consumed by the handler.

    Params
    -

    on-delete: func

    +

    on-delete: func

    Handle the delete event for the given bucket and key. It returns a key that represents the key being deleted.

    Params