Skip to Content
References

src.uagents.storage.init

StorageAPI Objects - Github

class StorageAPI(ABC)

Interface for a key-value like storage system.

KeyValueStore Objects - Github

class KeyValueStore(StorageAPI)

A simple key-value store implementation for data storage.

Attributes:

  • _data dict - The internal data storage dictionary.
  • _name str - The name associated with the store.
  • _path str - The file path where the store data is stored.

Methods:

  • __init__ - Initialize the KeyValueStore instance.
  • get - Get the value associated with a key from the store.
  • has - Check if a key exists in the store.
  • set - Set a value associated with a key in the store.
  • remove - Remove a key and its associated value from the store.
  • clear - Clear all data from the store.
  • _load - Load data from the file into the store.
  • _save - Save the store data to the file.

init - Github

def __init__(name: str, cwd: Optional[str] = None)

Initialize the KeyValueStore instance.

Arguments:

  • name str - The name associated with the store.
  • cwd str, optional - The current working directory. Defaults to None.

load_all_keys - Github

def load_all_keys() -> dict

Load all private keys from the private keys file.

Returns:

  • dict - A dictionary containing loaded private keys.

save_private_keys - Github

def save_private_keys(name: str, identity_key: str, wallet_key: str)

Save private keys to the private keys file.

Arguments:

  • name str - The name associated with the private keys.
  • identity_key str - The identity private key.
  • wallet_key str - The wallet private key.

get_or_create_private_keys - Github

def get_or_create_private_keys(name: str) -> Tuple[str, str]

Get or create private keys associated with a name.

Arguments:

  • name str - The name associated with the private keys.

Returns:

Tuple[str, str]: A tuple containing the identity key and wallet key.

Last updated on