api: declare BaseAPI._message to be abstract

Now that all API providers are converted to use the high level
dispatcher, make the implementation of that mandatory by declaring
it an abstract method.
This commit is contained in:
Christian Kellner 2020-07-24 20:11:03 +02:00 committed by Tom Gundersen
parent 6f8b850ef2
commit b2d406f941

View file

@ -27,7 +27,7 @@ class BaseAPI(abc.ABC):
when the context is left.
New messages are delivered via the `_message` method, that
is meant to be implemented by deriving classes.
needs to be implemented by deriving classes.
Optionally, the `_cleanup` method can be implemented, to
clean up resources after the context is left and the
@ -50,6 +50,7 @@ class BaseAPI(abc.ABC):
def endpoint(cls):
"""The name of the API endpoint"""
@abc.abstractmethod
def _message(self, msg: Dict, fds: jsoncomm.FdSet, sock: jsoncomm.Socket, addr: str):
"""Called for a new incoming message"""