Classes | |
| class | _StoreManager |
| class | Store |
Functions | |
| None | __init__ (self, HomeAssistant hass, int version, str key, bool private=False, *bool atomic_writes=False, type[JSONEncoder]|None encoder=None, int minor_version=1, bool read_only=False) |
| None | _async_callback_delayed_write (self) |
| None | _async_callback_final_write (self, Event _event) |
| None | _async_cleanup_delay_listener (self) |
| None | _async_cleanup_final_write_listener (self) |
| None | _async_ensure_final_write_listener (self) |
| def | _async_handle_write_data (self, *_args) |
| _T|None | _async_load (self) |
| def | _async_load_data (self) |
| def | _async_migrate_func (self, old_major_version, old_minor_version, old_data) |
| None | _async_reschedule_delayed_write (self, float when) |
| None | _async_schedule_callback_delayed_write (self) |
| None | _async_write_data (self, str path, dict data) |
| def | _T |
| None | _write_data (self, str path, dict data) |
| None | async_delay_save (self, Callable[[], _T] data_func, float delay=0) |
| _T|None | async_load (self) |
| None | async_remove (self) |
| None | async_save (self, _T data) |
| _StoreManager | get_internal_store_manager (HomeAssistant hass) |
| None | make_read_only (self) |
| def | path (self) |
Variables | |
| _atomic_writes | |
| _data | |
| _delay_handle | |
| _encoder | |
| _load_future | |
| _LOGGER = logging.getLogger(__name__) | |
| _manager | |
| _next_write_time | |
| _private | |
| _read_only | |
| _unsub_final_write_listener | |
| _write_lock | |
| hass | |
| key | |
| int | MANAGER_CLEANUP_DELAY = 60 |
| int | MAX_LOAD_CONCURRENTLY = 6 |
| minor_version | |
| string | STORAGE_DIR = ".storage" |
| version | |
Helper to help store data.
| None homeassistant.helpers.storage.__init__ | ( | self, | |
| HomeAssistant | hass, | ||
| int | version, | ||
| str | key, | ||
| bool | private = False, |
||
| *bool | atomic_writes = False, |
||
| type[JSONEncoder] | None | encoder = None, |
||
| int | minor_version = 1, |
||
| bool | read_only = False |
||
| ) |
|
private |
Handle a delayed write callback.
Definition at line 510 of file storage.py.
|
private |
Handle a write because Home Assistant is in final write state.
Definition at line 518 of file storage.py.
|
private |
Clean up a delay listener.
Definition at line 504 of file storage.py.
|
private |
Clean up a stop listener.
Definition at line 497 of file storage.py.
|
private |
Ensure that we write if we quit before delay has passed.
Definition at line 488 of file storage.py.
|
private |
Handle writing the config.
Definition at line 523 of file storage.py.
|
private |
Load the data and ensure the task is removed.
Definition at line 305 of file storage.py.
|
private |
Load the data.
Definition at line 312 of file storage.py.
|
private |
Migrate to the new version.
Definition at line 564 of file storage.py.
|
private |
Reschedule a delayed write.
Definition at line 468 of file storage.py.
|
private |
Schedule the delayed write in a task.
Definition at line 475 of file storage.py.
|
private |
Definition at line 545 of file storage.py.
|
private |
Definition at line 54 of file storage.py.
|
private |
Write the data.
Definition at line 548 of file storage.py.
| None homeassistant.helpers.storage.async_delay_save | ( | self, | |
| Callable[[], _T] | data_func, | ||
| float | delay = 0 |
||
| ) |
Save data with an optional delay.
Definition at line 440 of file storage.py.
| _T | None homeassistant.helpers.storage.async_load | ( | self | ) |
Load data. If the expected version and minor version do not match the given versions, the migrate function will be invoked with migrate_func(version, minor_version, config). Will ensure that when a call comes in while another one is in progress, the second call will wait and return the result of the first call.
Definition at line 275 of file storage.py.
| None homeassistant.helpers.storage.async_remove | ( | self | ) |
Remove all data.
Definition at line 568 of file storage.py.
| None homeassistant.helpers.storage.async_save | ( | self, | |
| _T | data | ||
| ) |
Save data.
Definition at line 424 of file storage.py.
| _StoreManager homeassistant.helpers.storage.get_internal_store_manager | ( | HomeAssistant | hass | ) |
Get the store manager. This function is not part of the API and should only be used in the Home Assistant core internals. It is not guaranteed to be stable.
Definition at line 93 of file storage.py.
| None homeassistant.helpers.storage.make_read_only | ( | self | ) |
Make the store read-only. This method is irreversible.
Definition at line 268 of file storage.py.
| def homeassistant.helpers.storage.path | ( | self | ) |
Return the config path.
Definition at line 264 of file storage.py.
|
private |
Definition at line 258 of file storage.py.
|
private |
Definition at line 426 of file storage.py.
|
private |
Definition at line 470 of file storage.py.
|
private |
Definition at line 257 of file storage.py.
|
private |
Definition at line 288 of file storage.py.
|
private |
Definition at line 45 of file storage.py.
|
private |
Definition at line 261 of file storage.py.
|
private |
Definition at line 260 of file storage.py.
|
private |
Definition at line 251 of file storage.py.
|
private |
Definition at line 259 of file storage.py.
|
private |
Definition at line 491 of file storage.py.
|
private |
Definition at line 255 of file storage.py.
| homeassistant.helpers.storage.hass |
Definition at line 250 of file storage.py.
| homeassistant.helpers.storage.key |
Definition at line 249 of file storage.py.
| int homeassistant.helpers.storage.MANAGER_CLEANUP_DELAY = 60 |
Definition at line 50 of file storage.py.
| int homeassistant.helpers.storage.MAX_LOAD_CONCURRENTLY = 6 |
Definition at line 42 of file storage.py.
| homeassistant.helpers.storage.minor_version |
Definition at line 248 of file storage.py.
| string homeassistant.helpers.storage.STORAGE_DIR = ".storage" |
Definition at line 44 of file storage.py.
| homeassistant.helpers.storage.version |
Definition at line 247 of file storage.py.