33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from .dispatcher import dispatcher
|
|
from .context import Context
|
|
|
|
|
|
class Controller:
|
|
"""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"""
|
|
version, uri = uri.split('.', 1)
|
|
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)
|
|
|
|
async def on_join(self,
|
|
risotto_context):
|
|
pass
|