mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
* Structured data refactor - multi-index tables, remove need for manual mods to the Cassandra tables * Tech spec updated to track implementation
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from ... schema import RowsQueryRequest, RowsQueryResponse
|
|
from ... messaging import TranslatorRegistry
|
|
|
|
from . requestor import ServiceRequestor
|
|
|
|
class RowsQueryRequestor(ServiceRequestor):
|
|
def __init__(
|
|
self, backend, request_queue, response_queue, timeout,
|
|
consumer, subscriber,
|
|
):
|
|
|
|
super(RowsQueryRequestor, self).__init__(
|
|
backend=backend,
|
|
request_queue=request_queue,
|
|
response_queue=response_queue,
|
|
request_schema=RowsQueryRequest,
|
|
response_schema=RowsQueryResponse,
|
|
subscription = subscriber,
|
|
consumer_name = consumer,
|
|
timeout=timeout,
|
|
)
|
|
|
|
self.request_translator = TranslatorRegistry.get_request_translator("rows-query")
|
|
self.response_translator = TranslatorRegistry.get_response_translator("rows-query")
|
|
|
|
def to_request(self, body):
|
|
return self.request_translator.to_pulsar(body)
|
|
|
|
def from_response(self, message):
|
|
return self.response_translator.from_response_with_completion(message)
|