Resource

store

A KV Store.

resource store;

F lookup

lookup: func(key: string) -> result​<option​<entry>, kv-error>;

Looks up a value in the KV Store.

Returns ok(some(v)) with the value v that was found, ok(none) if no value was found, or err(e) indicating the error e occurred.

This function waits until the operation completes.

F lookup-async

lookup-async: func(key: string) -> result​<pending-lookup, error>;

Look up a value in the KV Store asynchronously.

This function initiates an async lookup of a value in the KV Store. Use await-lookup to finish the lookup.

F insert

insert: func(key: string, body: body, options: insert-options) -> result​<_, kv-error>;

Inserts a value into the KV Store.

If the KV Store already contains a value for this key, the mode field of the options argument specifies how the existing value is handled.

This function waits until the operation completes.

F insert-async

insert-async: func(key: string, body: body, options: insert-options) -> result​<pending-insert, error>;

Insert a value into the KV Store asynchronously.

If the KV Store already contains a value for this key, the mode field of the options argument specifies how the existing value is handled.

This function initiates an async insert of a value in the KV Store. Use await-insert to finish the lookup.

F delete

delete: func(key: string) -> result​<bool, kv-error>;

Deletes a value in the KV Store.

Returns ok(true) if a value was successfully deleted, ok(false) if no value was found, or err(e) indicating the error e occurred.

This function waits until the operation completes.

F delete-async

delete-async: func(key: string) -> result​<pending-delete, error>;

Delete of a value in the KV Store.

This function initiates an async delete of a value in the KV Store. Use await-delete to finish the lookup.

F list

list: func(options: list-options) -> result​<body, kv-error>;

Lists keys in the KV Store.

Returns ok(b) with the body b on success, or err(e) indicating the error e occurred.

This function waits until the operation completes.

F list-async

list-async: func(options: list-options) -> result​<pending-list, error>;

List of keys in the KV Store.

This function initiates an async list value in the KV Store. Use await-list to finish the lookup.

F open

open: func(name: string) -> result​<store, open-error>;

Opens the KV Store with the given name.