1 """Google Calendar local storage."""
3 from __future__
import annotations
8 from gcal_sync.store
import CalendarStore
13 from .const
import DOMAIN
15 _LOGGER = logging.getLogger(__name__)
17 STORAGE_KEY_FORMAT =
"{domain}.{entry_id}"
20 STORAGE_SAVE_DELAY_SECONDS = 120
24 """Storage for local persistence of calendar and event data."""
26 def __init__(self, hass: HomeAssistant, entry_id: str) ->
None:
27 """Initialize LocalCalendarStore."""
28 self.
_store_store = Store[dict[str, Any]](
31 STORAGE_KEY_FORMAT.format(domain=DOMAIN, entry_id=entry_id),
34 self.
_data_data: dict[str, Any] |
None =
None
38 if self.
_data_data
is None:
40 return self.
_data_data
42 async
def async_save(self, data: dict[str, Any]) ->
None:
44 self.
_data_data = data
46 def provide_data() -> dict:
dict[str, Any]|None async_load(self)
None __init__(self, HomeAssistant hass, str entry_id)
None async_save(self, dict[str, Any] data)
None async_delay_save(self, Callable[[], _T] data_func, float delay=0)