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
-
Error_AccessDenied()
Expand source code
@dataclass class Error_AccessDenied: pass
class Error_NoSuchStore
-
Error_NoSuchStore()
Expand source code
@dataclass class Error_NoSuchStore: pass
class Error_Other (value: str)
-
Error_Other(value: str)
Expand source code
@dataclass class Error_Other: value: str
Class variables
var value : str
class Error_StoreTableFull
-
Error_StoreTableFull()
Expand source code
@dataclass class Error_StoreTableFull: pass
class Store
-
An open key-value 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
Static methods
def open(label: str) ‑> Self
Methods
def delete(self, key: str) ‑> None
def exists(self, key: str) ‑> bool
def get(self, key: str) ‑> bytes | None
def get_keys(self) ‑> List[str]
def set(self, key: str, value: bytes) ‑> None