hoops_ai.storage.datastorage.memory_storage_handler
Classes
- class hoops_ai.storage.datastorage.memory_storage_handler.MemoryStorage
Bases:
DataStorage- close()
Clears the stored data and metadata from memory.
- Return type:
None
- compress_store()
This method is a placeholder, as in-memory storage does not require compression.
- Returns:
Always returns 0 as no compression is performed.
- Return type:
- format()
Returns the format of this storage.
- Returns:
A string specifying that this is in-memory storage.
- Return type:
- get_file_path(data_key)
Since this is an in-memory storage, file paths do not exist. For compatibility with code that expects a directory path for the root (“”), we return a temporary directory path. For specific keys, we return a descriptive message.
- get_group_for_array(array_name)
Determines which group an array belongs to based on the schema.
- get_keys()
Retrieves a list of all stored data keys.
- Returns:
A list of keys in the storage.
- Return type:
- get_schema()
Retrieves the schema definition for this storage instance.
- Returns:
The schema definition, or empty dict if no schema is set
- Return type:
- load_data(data_key)
Loads data from memory by key.
- load_metadata(key)
Loads metadata by key from memory storage. Supports nested keys using ‘/’ as a separator.
- save_data(data_key, data)
Stores the data in memory and tracks file size.
- Parameters:
data_key (str) – The key under which to store the data.
data (Any) – The data to store.
- Return type:
None
- save_metadata(key, value)
Stores metadata as a key-value pair in memory. Supports nested keys using ‘/’ as a separator.
- Parameters:
key (str) – The metadata key, which can be a nested key using ‘/’ as a separator.
value (Any) – The metadata value.
- Return type:
None