Data storage#

The policyengine_core.data_storage module contains two classes that are used to handle the storage of data in simulations.

InMemoryStorage#

class policyengine_core.data_storage.in_memory_storage.InMemoryStorage(is_eternal: bool)[source]#

Bases: object

Low-level class responsible for storing and retrieving calculated vectors in memory

clone() InMemoryStorage[source]#
delete(period: Optional[Period] = None, branch_name: str = 'default') None[source]#
get(period: Period, branch_name: str = 'default') Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]][source]#
get_known_branch_periods() list[source]#
get_known_periods() list[source]#
get_memory_usage() dict[source]#
is_eternal: bool#
put(value: Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], period: Period, branch_name: str = 'default') None[source]#

OnDiskStorage#

class policyengine_core.data_storage.on_disk_storage.OnDiskStorage(storage_dir: str, is_eternal: bool = False, preserve_storage_dir: bool = False)[source]#

Bases: object

Low-level class responsible for storing and retrieving calculated vectors on disk

delete(period: Optional[Period] = None, branch_name: str = 'default') None[source]#
get(period: Period, branch_name: str = 'default') Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]][source]#
get_known_branch_periods() list[source]#
get_known_periods() list[source]#
put(value: Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], period: Period, branch_name: str = 'default') None[source]#
restore() None[source]#