PersistenceManager
Defines a manager that can load configuration data from a directory
or, maybe in the future, a SQL database or similar.
Requires class that supports from_config
to load and to_config
to save.
__init__(self, cls, persistence_loc=None):
cls
:type
persistence_loc
:str | None
location from which to load/save objects
obj_loc(self, key):
load_config(self, key, make_new=False, init=None):
Loads the config for the persistent structure named key
key
:Any
:returns
:_
new_config(self, key, init=None):
Creates a new space and config for the persistent structure named key
key
:str
name for job
init
:str | dict | None
initial parameters
:returns
:_
contains(self, key):
Checks if key
is a supported persistent structure
key
:Any
:returns
:_
load(self, key, make_new=False, strict=True, init=None):
Loads the persistent structure named key
key
:Any
:returns
:_
save(self, obj):
Saves requisite config data for a structure
obj
:Any
:returns
:_