mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-23 00:18:31 +01:00
22 lines
553 B
Python
22 lines
553 B
Python
|
from abc import ABC, abstractmethod
|
||
|
from typing import Any, Callable
|
||
|
|
||
|
|
||
|
class Communicator(ABC):
|
||
|
"""pub/sub model via specific protocol."""
|
||
|
|
||
|
@abstractmethod
|
||
|
def publish(self, topic: str, payload: Any, retain: bool = False) -> None:
|
||
|
"""Send data via specific protocol."""
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def subscribe(self, receiver: Callable) -> None:
|
||
|
"""Pass receiver so communicators can pass commands."""
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def stop(self) -> None:
|
||
|
"""Stop the communicator."""
|
||
|
pass
|