diff options
author | Maxim Devaev <[email protected]> | 2024-11-02 18:06:45 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-11-02 18:06:52 +0200 |
commit | 0fd1174bc5354d8f69adde3218edd121e48c84f0 (patch) | |
tree | 5eb78947f32cb8405283fbc1351fae3272efd6c2 /kvmd | |
parent | d4fb640418efdb924bf30f1487acde4a675d6e2f (diff) |
granularity info and minor fixes
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/info/__init__.py | 9 | ||||
-rw-r--r-- | kvmd/apps/kvmd/ocr.py | 5 | ||||
-rw-r--r-- | kvmd/apps/kvmd/streamer.py | 8 | ||||
-rw-r--r-- | kvmd/apps/kvmd/ugpio.py | 6 | ||||
-rw-r--r-- | kvmd/plugins/atx/__init__.py | 6 | ||||
-rw-r--r-- | kvmd/plugins/msd/__init__.py | 12 |
6 files changed, 46 insertions, 0 deletions
diff --git a/kvmd/apps/kvmd/info/__init__.py b/kvmd/apps/kvmd/info/__init__.py index b346c10c..9ede5489 100644 --- a/kvmd/apps/kvmd/info/__init__.py +++ b/kvmd/apps/kvmd/info/__init__.py @@ -65,6 +65,15 @@ class InfoManager: ]) async def poll_state(self) -> AsyncGenerator[dict, None]: + # ==== Granularity table ==== + # - system -- Partial + # - auth -- Partial + # - meta -- Partial, nullable + # - extras -- Partial, nullable + # - hw -- Partial + # - fan -- Partial + # =========================== + while True: (field, value) = await self.__queue.get() yield {field: value} diff --git a/kvmd/apps/kvmd/ocr.py b/kvmd/apps/kvmd/ocr.py index e110a720..367c0c80 100644 --- a/kvmd/apps/kvmd/ocr.py +++ b/kvmd/apps/kvmd/ocr.py @@ -129,6 +129,11 @@ class Ocr: self.__notifier.notify() async def poll_state(self) -> AsyncGenerator[dict, None]: + # ===== Granularity table ===== + # - enabled -- Full + # - langs -- Partial + # ============================= + while True: await self.__notifier.wait() yield (await self.get_state()) diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py index d02bf50d..08c48eb1 100644 --- a/kvmd/apps/kvmd/streamer.py +++ b/kvmd/apps/kvmd/streamer.py @@ -287,6 +287,14 @@ class Streamer: # pylint: disable=too-many-instance-attributes self.__notifier.notify(self.__ST_FULL) async def poll_state(self) -> AsyncGenerator[dict, None]: + # ==== Granularity table ==== + # - features -- Full + # - limits -- Partial, paired with params + # - params -- Partial, paired with limits + # - streamer -- Partial, nullable + # - snapshot -- Partial + # =========================== + def signal_handler(*_: Any) -> None: get_logger(0).info("Got SIGUSR2, checking the stream state ...") self.__notifier.notify(self.__ST_STREAMER) diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py index b5b4a621..e4735c61 100644 --- a/kvmd/apps/kvmd/ugpio.py +++ b/kvmd/apps/kvmd/ugpio.py @@ -271,6 +271,12 @@ class UserGpio: self.__notifier.notify(1) async def poll_state(self) -> AsyncGenerator[dict, None]: + # ==== Granularity table ==== + # - model -- Full + # - state.inputs -- Partial + # - state.outputs -- Partial + # =========================== + prev: dict = {"inputs": {}, "outputs": {}} while True: # pylint: disable=too-many-nested-blocks if (await self.__notifier.wait()) > 0: diff --git a/kvmd/plugins/atx/__init__.py b/kvmd/plugins/atx/__init__.py index 7545b030..d8bea96d 100644 --- a/kvmd/plugins/atx/__init__.py +++ b/kvmd/plugins/atx/__init__.py @@ -52,6 +52,12 @@ class BaseAtx(BasePlugin): raise NotImplementedError async def poll_state(self) -> AsyncGenerator[dict, None]: + # ==== Granularity table ==== + # - enabled -- Full + # - busy -- Partial + # - leds -- Partial + # =========================== + yield {} raise NotImplementedError diff --git a/kvmd/plugins/msd/__init__.py b/kvmd/plugins/msd/__init__.py index 193b81b1..b2f9d50e 100644 --- a/kvmd/plugins/msd/__init__.py +++ b/kvmd/plugins/msd/__init__.py @@ -121,6 +121,18 @@ class BaseMsd(BasePlugin): raise NotImplementedError() async def poll_state(self) -> AsyncGenerator[dict, None]: + # ==== Granularity table ==== + # - enabled -- Full + # - online -- Partial + # - busy -- Partial + # - drive -- Partial, nullable + # - storage -- Partial, nullable + # - storage.parts -- Partial + # - storage.images -- Partial + # - storage.downloading -- Partial, nullable + # - storage.uploading -- Partial, nullable + # =========================== + if self is not None: # XXX: Vulture and pylint hack raise NotImplementedError() yield |