diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e71c041 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + abi-up-to-date: + name: Check ABI files are up-to-date + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: WebAssembly/wit-abi-up-to-date@v22 + with: + wit-bindgen: '0.32.0' + worlds: 'imports watch-service' \ No newline at end of file diff --git a/imports.md b/imports.md index 4f23a4e..ca31a78 100644 --- a/imports.md +++ b/imports.md @@ -1,4 +1,4 @@ -

World imports

+

World imports

The wasi:keyvalue/imports world provides common APIs for interacting with key-value stores. Components targeting this world will be able to do:

    @@ -9,13 +9,13 @@ Components targeting this world will be able to do:

    -

    Import interface wasi:keyvalue/store@0.2.0-draft2

    +

    Import interface wasi:keyvalue/store@0.2.0-draft2

    A keyvalue interface that provides eventually consistent key-value operations.

    Each of these operations acts on a single key-value pair.

    The value in the key-value pair is defined as a u8 byte array and the intention is that it is @@ -39,39 +39,39 @@ quick succession, then the client may get C. However, a client running in a sepa still see A or B


    Types

    -

    variant error

    +

    variant error

    The set of errors which may be raised by functions in this package

    Variant Cases
    -

    record key-response

    +

    record key-response

    A response to a list-keys operation.

    Record Fields
    -

    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.

    It is worth noting that the exact terminology for bucket in key-value stores can very @@ -87,19 +87,19 @@ depending on the specific implementation. For example:

In this interface, we use the term bucket to refer to a collection of key-value pairs

Functions

-

open: func

+

open: func

Get the bucket with the specified identifier.

identifier must refer to a bucket provided by the host.

error::no-such-store will be raised if the identifier is not recognized.

Params
Return values
-

[method]bucket.get: func

+

[method]bucket.get: func

Get the value associated with the specified key

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

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

Params
Return values
-

[method]bucket.set: func

+

[method]bucket.set: func

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

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

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

Params
Return values
-

[method]bucket.delete: func

+

[method]bucket.delete: func

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

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

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

Params
Return values
-

[method]bucket.exists: func

+

[method]bucket.exists: func

Check if the key exists in the store.

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

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

Params
Return values
-

[method]bucket.list-keys: func

+

[method]bucket.list-keys: func

Get all the keys in the store with an optional cursor (for use in pagination). It returns a list of keys. Please note that for most KeyValue implementations, this is a can be a very expensive operation and so it should be used judiciously. Implementations @@ -171,14 +171,14 @@ for more information.

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

Params
Return values
-

Import interface wasi:keyvalue/atomics@0.2.0-draft2

+

Import interface wasi:keyvalue/atomics@0.2.0-draft2

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 operation that the action either completed @@ -189,24 +189,24 @@ wit. Future version of the interface will instead extend these methods on the ba resource.


Types

-

type bucket

+

type bucket

bucket

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

-#### `resource cas` +#### `resource cas`

A handle to a CAS (compare-and-swap) operation.

-

variant cas-error

+

variant cas-error

The error returned by a CAS operation

Variant Cases

Functions

-

[static]cas.new: func

+

[static]cas.new: func

Construct a new CAS operation. Implementors can map the underlying functionality (transactions, versions, etc) as desired.

Params
Return values
-

[method]cas.current: func

+

[method]cas.current: func

Get the current value of the key (if it exists). This allows for avoiding reads if all that is needed to ensure the atomicity of the operation

Params
Return values
-

increment: func

+

increment: func

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

If the key does not exist in the store, it creates a new key-value pair with the value set @@ -245,27 +245,27 @@ to the given delta.

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

Params
Return values
-

swap: func

+

swap: func

Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if the CAS operation failed.

Params
Return values
-

Import interface wasi:keyvalue/batch@0.2.0-draft2

+

Import interface wasi:keyvalue/batch@0.2.0-draft2

A keyvalue interface that provides 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, if you want to @@ -282,15 +282,15 @@ wit. Future version of the interface will instead extend these methods on the ba resource.


Types

-

type bucket

+

type bucket

bucket

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

----

Functions

-

get-many: func

+

get-many: func

Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs.

If any of the keys do not exist in the store, it returns a none value for that pair in the @@ -299,14 +299,14 @@ list.

If any other 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 store. If the key already exists in the store, it overwrites the value.

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

@@ -318,14 +318,14 @@ 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 store.

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

@@ -337,10 +337,10 @@ fail.

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

Params
Return values
diff --git a/watch-service.md b/watch-service.md index b444f66..a65115a 100644 --- a/watch-service.md +++ b/watch-service.md @@ -1,19 +1,19 @@ -

World watch-service

+

World watch-service

-

Import interface wasi:keyvalue/store@0.2.0-draft2

+

Import interface wasi:keyvalue/store@0.2.0-draft2

A keyvalue interface that provides eventually consistent key-value operations.

Each of these operations acts on a single key-value pair.

The value in the key-value pair is defined as a u8 byte array and the intention is that it is @@ -37,39 +37,39 @@ quick succession, then the client may get C. However, a client running in a sepa still see A or B


Types

-

variant error

+

variant error

The set of errors which may be raised by functions in this package

Variant Cases
-

record key-response

+

record key-response

A response to a list-keys operation.

Record Fields
-

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.

It is worth noting that the exact terminology for bucket in key-value stores can very @@ -85,19 +85,19 @@ depending on the specific implementation. For example:

In this interface, we use the term bucket to refer to a collection of key-value pairs

Functions

-

open: func

+

open: func

Get the bucket with the specified identifier.

identifier must refer to a bucket provided by the host.

error::no-such-store will be raised if the identifier is not recognized.

Params
Return values
-

[method]bucket.get: func

+

[method]bucket.get: func

Get the value associated with the specified key

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

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

Params
Return values
-

[method]bucket.set: func

+

[method]bucket.set: func

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

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

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

Params
Return values
-

[method]bucket.delete: func

+

[method]bucket.delete: func

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

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

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

Params
Return values
-

[method]bucket.exists: func

+

[method]bucket.exists: func

Check if the key exists in the store.

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

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

Params
Return values
-

[method]bucket.list-keys: func

+

[method]bucket.list-keys: func

Get all the keys in the store with an optional cursor (for use in pagination). It returns a list of keys. Please note that for most KeyValue implementations, this is a can be a very expensive operation and so it should be used judiciously. Implementations @@ -169,14 +169,14 @@ for more information.

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

Params
Return values
-

Import interface wasi:keyvalue/atomics@0.2.0-draft2

+

Import interface wasi:keyvalue/atomics@0.2.0-draft2

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 operation that the action either completed @@ -187,24 +187,24 @@ wit. Future version of the interface will instead extend these methods on the ba resource.


Types

-

type bucket

+

type bucket

bucket

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

-#### `resource cas` +#### `resource cas`

A handle to a CAS (compare-and-swap) operation.

-

variant cas-error

+

variant cas-error

The error returned by a CAS operation

Variant Cases

Functions

-

[static]cas.new: func

+

[static]cas.new: func

Construct a new CAS operation. Implementors can map the underlying functionality (transactions, versions, etc) as desired.

Params
Return values
-

[method]cas.current: func

+

[method]cas.current: func

Get the current value of the key (if it exists). This allows for avoiding reads if all that is needed to ensure the atomicity of the operation

Params
Return values
-

increment: func

+

increment: func

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

If the key does not exist in the store, it creates a new key-value pair with the value set @@ -243,27 +243,27 @@ to the given delta.

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

Params
Return values
-

swap: func

+

swap: func

Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if the CAS operation failed.

Params
Return values
-

Import interface wasi:keyvalue/batch@0.2.0-draft2

+

Import interface wasi:keyvalue/batch@0.2.0-draft2

A keyvalue interface that provides 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, if you want to @@ -280,15 +280,15 @@ wit. Future version of the interface will instead extend these methods on the ba resource.


Types

-

type bucket

+

type bucket

bucket

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

----

Functions

-

get-many: func

+

get-many: func

Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs.

If any of the keys do not exist in the store, it returns a none value for that pair in the @@ -297,14 +297,14 @@ list.

If any other 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 store. If the key already exists in the store, it overwrites the value.

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

@@ -316,14 +316,14 @@ 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 store.

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

@@ -335,35 +335,35 @@ fail.

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

Params
Return values
-

Export interface wasi:keyvalue/watcher@0.2.0-draft2

+

Export interface wasi:keyvalue/watcher@0.2.0-draft2


Types

-

type bucket

+

type bucket

bucket

----

Functions

-

on-set: func

+

on-set: func

Handle the set event for the given bucket and key. It includes a reference to the bucket that can be used to interact with the store.

Params
-

on-delete: func

+

on-delete: func

Handle the delete event for the given bucket and key. It includes a reference to the bucket that can be used to interact with the store.

Params