risotto/src/risotto/controller.py

33 lines
1.0 KiB
Python
Raw Normal View History

2019-11-28 14:50:53 +01:00
from .dispatcher import dispatcher
2019-11-28 16:51:56 +01:00
from .context import Context
2019-11-28 14:50:53 +01:00
class Controller:
2019-11-28 16:51:56 +01:00
"""Common controller used to add a service in Risotto
"""
async def call(self,
uri: str,
risotto_context: Context,
**kwargs):
""" a wrapper to dispatcher's call"""
2019-11-28 14:50:53 +01:00
version, uri = uri.split('.', 1)
2019-11-28 16:51:56 +01:00
return await dispatcher.call(version,
uri,
risotto_context,
**kwargs)
async def publish(self,
uri: str,
risotto_context: Context,
**kwargs):
""" a wrapper to dispatcher's publish"""
version, uri = uri.split('.', 1)
await dispatcher.publish(version,
uri,
risotto_context,
**kwargs)
2019-12-02 10:29:40 +01:00
async def on_join(self,
risotto_context):
pass