Module spin_sdk.wit.imports.spin_key_value_key_value_3_0_0
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: passError_AccessDenied()
class Error_NoSuchStore-
Expand source code
@dataclass class Error_NoSuchStore: passError_NoSuchStore()
class Error_Other (value: str)-
Expand source code
@dataclass class Error_Other: value: strError_Other(value: str)
Instance variables
var value : str
class Error_StoreTableFull-
Expand source code
@dataclass class Error_StoreTableFull: passError_StoreTableFull()
class Store-
Expand source code
class Store: """ An open key-value store """ @classmethod async 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: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedError async 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: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedError async def set(self, key: str, value: bytes) -> None: """ Set the `value` associated with the specified `key` overwriting any existing value. Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedError async 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: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedError async def exists(self, key: str) -> bool: """ Return whether a tuple exists for the specified `key` Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedError async def get_keys(self) -> Tuple[StreamReader[str], FutureReader[Result[None, Error]]]: """ Return a list of all the keys """ 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 NotImplementedErrorAn open key-value store
Static methods
async def open(label: str) ‑> Self-
Open the store with the specified label.
labelmust refer to a store allowed in the spin.toml manifest.error::no-such-storewill be raised if thelabelis not recognized.Raises:
componentize_py_types.Err(Error)
Methods
async def delete(self, key: str) ‑> None-
Expand source code
async 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: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedErrorDelete the tuple with the specified
keyNo error is raised if a tuple did not previously exist for
key.Raises:
componentize_py_types.Err(Error) async def exists(self, key: str) ‑> bool-
Expand source code
async def exists(self, key: str) -> bool: """ Return whether a tuple exists for the specified `key` Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedErrorReturn whether a tuple exists for the specified
keyRaises:
componentize_py_types.Err(Error) async def get(self, key: str) ‑> bytes | None-
Expand source code
async 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: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedErrorGet the value associated with the specified
keyReturns
ok(none)if the key does not exist.Raises:
componentize_py_types.Err(Error) async def get_keys(self) ‑> Tuple[componentize_py_async_support.streams.StreamReader[str], componentize_py_async_support.futures.FutureReader[componentize_py_types.Ok[None] | componentize_py_types.Err[Error_StoreTableFull | Error_NoSuchStore | Error_AccessDenied | Error_Other]]]-
Expand source code
async def get_keys(self) -> Tuple[StreamReader[str], FutureReader[Result[None, Error]]]: """ Return a list of all the keys """ raise NotImplementedErrorReturn a list of all the keys
async def set(self, key: str, value: bytes) ‑> None-
Expand source code
async def set(self, key: str, value: bytes) -> None: """ Set the `value` associated with the specified `key` overwriting any existing value. Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_key_value_key_value_3_0_0.Error)` """ raise NotImplementedErrorSet the
valueassociated with the specifiedkeyoverwriting any existing value.Raises:
componentize_py_types.Err(Error)