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 @@ -
The wasi:keyvalue/imports
world provides common APIs for interacting with key-value stores.
Components targeting this world will be able to do:
wasi:keyvalue/store@0.2.0-draft2
wasi:keyvalue/atomics@0.2.0-draft2
wasi:keyvalue/batch@0.2.0-draft2
wasi:keyvalue/store@0.2.0-draft2
wasi:keyvalue/atomics@0.2.0-draft2
wasi:keyvalue/batch@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
variant error
variant error
The set of errors which may be raised by functions in this package
The host does not recognize the store identifier requested.
The requesting component does not have access to the specified store (which may or may not exist).
Some implementation-specific error has occurred (e.g. I/O)
record key-response
record key-response
A response to a list-keys
operation.
The list of keys returned by the query.
The continuation token to use to fetch the next page of keys. If this is `null`, then there are no more keys to fetch.
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:
bucket
to refer to a collection of key-value pairsopen: 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.
[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)
.
[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)
.
self
: borrow<bucket
>key
: string
value
: list<u8
>self
: borrow<bucket
>key
: string
value
: list<u8
>[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)
.
[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)
.
[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)
.
key-response
, error
>key-response
, error
>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.
type bucket
type 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
store-error
: error
store-error
: error
A store error occurred when performing the operation
cas-failed
: own<cas
>
cas-failed
: own<cas
>
The CAS operation failed because the value was too old. This returns a new CAS handle for easy retries. Implementors MUST return a CAS handle that has been updated to the latest version or transaction. @@ -214,30 +214,30 @@ latest version or transaction.
[static]cas.new: func
[static]cas.new: func
Construct a new CAS operation. Implementors can map the underlying functionality (transactions, versions, etc) as desired.
[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
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)
.
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.
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.
type bucket
type bucket
-#### `type error` +#### `type error` [`error`](#error)
----
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)
.
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.
bucket
: borrow<bucket
>key-values
: list<(string
, list<u8
>)>bucket
: borrow<bucket
>key-values
: list<(string
, list<u8
>)>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.
wasi:keyvalue/store@0.2.0-draft2
wasi:keyvalue/atomics@0.2.0-draft2
wasi:keyvalue/batch@0.2.0-draft2
wasi:keyvalue/store@0.2.0-draft2
wasi:keyvalue/atomics@0.2.0-draft2
wasi:keyvalue/batch@0.2.0-draft2
wasi:keyvalue/watcher@0.2.0-draft2
wasi:keyvalue/watcher@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
variant error
variant error
The set of errors which may be raised by functions in this package
The host does not recognize the store identifier requested.
The requesting component does not have access to the specified store (which may or may not exist).
Some implementation-specific error has occurred (e.g. I/O)
record key-response
record key-response
A response to a list-keys
operation.
The list of keys returned by the query.
The continuation token to use to fetch the next page of keys. If this is `null`, then there are no more keys to fetch.
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:
bucket
to refer to a collection of key-value pairsopen: 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.
[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)
.
[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)
.
self
: borrow<bucket
>key
: string
value
: list<u8
>self
: borrow<bucket
>key
: string
value
: list<u8
>[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)
.
[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)
.
[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)
.
key-response
, error
>key-response
, error
>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.
type bucket
type 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
store-error
: error
store-error
: error
A store error occurred when performing the operation
cas-failed
: own<cas
>
cas-failed
: own<cas
>
The CAS operation failed because the value was too old. This returns a new CAS handle for easy retries. Implementors MUST return a CAS handle that has been updated to the latest version or transaction. @@ -212,30 +212,30 @@ latest version or transaction.
[static]cas.new: func
[static]cas.new: func
Construct a new CAS operation. Implementors can map the underlying functionality (transactions, versions, etc) as desired.
[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
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)
.
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.
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.
type bucket
type bucket
-#### `type error` +#### `type error` [`error`](#error)
----
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)
.
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.
bucket
: borrow<bucket
>key-values
: list<(string
, list<u8
>)>bucket
: borrow<bucket
>key-values
: list<(string
, list<u8
>)>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.
type bucket
type bucket
----
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.
bucket
: own<bucket
>key
: string
value
: list<u8
>bucket
: own<bucket
>key
: string
value
: list<u8
>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.