Example #1
0
 def __init__(self, hostname: HostName) -> None:
     super().__init__()
     self._store = store.ObjectStore(
         path=cmk.utils.paths.discovered_host_labels_dir / f"{hostname}.mk",
         serializer=LabelsSerializer(),
     )
     self.file_path: Final = self._store.path
Example #2
0
 def _read(self, file_path: Path) -> HostsData:
     return store.ObjectStore(
         file_path, serializer=PickleSerializer()).read_obj(default={})
Example #3
0
 def _write(self, file_path: Path, data: HostsStorageData,
            value_formatter: Callable[[Any], str]) -> None:
     pickle_store = store.ObjectStore(file_path,
                                      serializer=PickleSerializer())
     with pickle_store.locked():
         pickle_store.write_obj(asdict(data))
Example #4
0
 def __init__(self, cache: MutableMapping[IPLookupCacheId,
                                          HostAddress]) -> None:
     self._cache = cache
     self._persist_on_update = True
     self._store = store.ObjectStore(self.PATH,
                                     serializer=IPLookupCacheSerializer())