Module spin_sdk.wit.imports.key_value

Global variables

var Error

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

Classes

class Error_AccessDenied
Expand source code
@dataclass class Error_AccessDenied: pass

Error_AccessDenied()

class Error_NoSuchStore
Expand source code
@dataclass class Error_NoSuchStore: pass

Error_NoSuchStore()

class Error_Other (value: str)
Expand source code
@dataclass class Error_Other: value: str

Error_Other(value: str)

Instance variables

var value : str
class Error_StoreTableFull
Expand source code
@dataclass class Error_StoreTableFull: pass

Error_StoreTableFull()

class Store
Expand source code
class Store: """ An open key-value store """ @classmethod def open(cls, label: str) -> Self: """ Open the store with the specified label. `label` must refer to a store allowed in the spin.toml manifest. `error::no-such-store` will be raised if the `label` is not recognized. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError def get(self, key: str) -> Optional[bytes]: """ Get the value associated with the specified `key` Returns `ok(none)` if the key does not exist. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError def set(self, key: str, value: bytes) -> None: """ Set the `value` associated with the specified `key` overwriting any existing value. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError def delete(self, key: str) -> None: """ Delete the tuple with the specified `key` No error is raised if a tuple did not previously exist for `key`. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError def exists(self, key: str) -> bool: """ Return whether a tuple exists for the specified `key` Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError def get_keys(self) -> List[str]: """ Return a list of all the keys Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError def __enter__(self) -> Self: """Returns self""" return self def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: """ Release this resource. """ raise NotImplementedError

An open key-value store

Static methods

def open(label: str) ‑> Self

Open the store with the specified label.

label must refer to a store allowed in the spin.toml manifest.

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

Raises: Err(Error)

Methods

def delete(self, key: str) ‑> None
Expand source code
def delete(self, key: str) -> None: """ Delete the tuple with the specified `key` No error is raised if a tuple did not previously exist for `key`. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError

Delete the tuple with the specified key

No error is raised if a tuple did not previously exist for key.

Raises: Err(Error)

def exists(self, key: str) ‑> bool
Expand source code
def exists(self, key: str) -> bool: """ Return whether a tuple exists for the specified `key` Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError

Return whether a tuple exists for the specified key

Raises: Err(Error)

def get(self, key: str) ‑> bytes | None
Expand source code
def get(self, key: str) -> Optional[bytes]: """ Get the value associated with the specified `key` Returns `ok(none)` if the key does not exist. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError

Get the value associated with the specified key

Returns ok(none) if the key does not exist.

Raises: Err(Error)

def get_keys(self) ‑> List[str]
Expand source code
def get_keys(self) -> List[str]: """ Return a list of all the keys Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError

Return a list of all the keys

Raises: Err(Error)

def set(self, key: str, value: bytes) ‑> None
Expand source code
def set(self, key: str, value: bytes) -> None: """ Set the `value` associated with the specified `key` overwriting any existing value. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)` """ raise NotImplementedError

Set the value associated with the specified key overwriting any existing value.

Raises: Err(Error)