risotto/src/risotto/controller.py

37 lines
1.1 KiB
Python

from .dispatcher import dispatcher
from .context import Context
class Controller:
"""Common controller used to add a service in Risotto
"""
def __init__(self,
test: bool):
pass
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