class documentation

class AsyncStateOfflineManager: (source)

Constructor: AsyncStateOfflineManager(offline_path)

View In Hierarchy

Class that handles archiving and restoring of supplied active states.

After you have called the restore_state() method, you have to call the clear_restored_state() method, so that the state files are deleted.

The reason for splitting it into two methods is that something might go wrong in your application, at least in the early stages and then the data would be gone forever (sometimes safety is better in foresight than hindsight).

Method __init__ The class constructor.
Async Method archive_state Archive supplied state(s).
Async Method clear_restored_state Remove archived state(s) after the restore was successful.
Async Method restore_state Restore previously archived state(s).
Instance Variable offline_path Path where files are archived and restored.
def __init__(self, offline_path: str): (source)

The class constructor.

Parameters
offline_path:strPath where files are archived and restored.
async def archive_state(self, active_states: dict, dump: bool = False): (source)

Archive supplied state(s).

Parameters
active_states:dictName of state, and its data.
dump:boolDump status (default is False).
async def clear_restored_state(self): (source)

Remove archived state(s) after the restore was successful.

async def restore_state(self) -> Union[dict, list]: (source)

Restore previously archived state(s).

Returns
Union[dict, list]Restored state(s).
offline_path: str = (source)

Path where files are archived and restored.