forked from DiamondLightSource/fastcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadapter.py
More file actions
34 lines (24 loc) · 843 Bytes
/
adapter.py
File metadata and controls
34 lines (24 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import asyncio
from fastcs.controller_api import ControllerAPI
from fastcs.transport import Transport
from .graphql import GraphQLServer
from .options import GraphQLOptions
class GraphQLTransport(Transport):
"""GraphQL transport."""
def __init__(self, options: GraphQLOptions | None = None):
self._options = options or GraphQLOptions()
def initialise(
self,
controller_api: ControllerAPI,
loop: asyncio.AbstractEventLoop,
):
self._server = GraphQLServer(controller_api)
@property
def options(self) -> GraphQLOptions:
return self._options
def create_docs(self) -> None:
raise NotImplementedError
def create_gui(self) -> None:
raise NotImplementedError
async def serve(self) -> None:
await self._server.serve(self.options.gql)