# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

import ocellus_module_service_pb2 as ocellus__module__service__pb2


class OcellusModuleServiceStub(object):
    """*
    Service for remote modules
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Bind = channel.stream_stream(
                '/ocellus.OcellusModuleService/Bind',
                request_serializer=ocellus__module__service__pb2.ModuleData.SerializeToString,
                response_deserializer=ocellus__module__service__pb2.StateEvent.FromString,
                )
        self.DownloadRef = channel.unary_unary(
                '/ocellus.OcellusModuleService/DownloadRef',
                request_serializer=ocellus__module__service__pb2.DownloadRefRequest.SerializeToString,
                response_deserializer=ocellus__module__service__pb2.DownloadRefResponse.FromString,
                )


class OcellusModuleServiceServicer(object):
    """*
    Service for remote modules
    """

    def Bind(self, request_iterator, context):
        """*
        Used to bind a remote module to the Ocellus.
        Initial bind response will always receive an empty StateEvent
        containing only the initial frame id. This can be used in two ways:

        1. If the remote module is generating data for the rest of the
        pipeline it may begin. For example, it may begin sending images
        and pointclouds.

        2. If the remote module is processing data only, the data will
        begin to arrive in the next message.

        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DownloadRef(self, request, context):
        """*
        Used to download reference URNs provided by StateEvents.
        The data will only be available from after an event has
        been received and a response is sent.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_OcellusModuleServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Bind': grpc.stream_stream_rpc_method_handler(
                    servicer.Bind,
                    request_deserializer=ocellus__module__service__pb2.ModuleData.FromString,
                    response_serializer=ocellus__module__service__pb2.StateEvent.SerializeToString,
            ),
            'DownloadRef': grpc.unary_unary_rpc_method_handler(
                    servicer.DownloadRef,
                    request_deserializer=ocellus__module__service__pb2.DownloadRefRequest.FromString,
                    response_serializer=ocellus__module__service__pb2.DownloadRefResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ocellus.OcellusModuleService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class OcellusModuleService(object):
    """*
    Service for remote modules
    """

    @staticmethod
    def Bind(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/ocellus.OcellusModuleService/Bind',
            ocellus__module__service__pb2.ModuleData.SerializeToString,
            ocellus__module__service__pb2.StateEvent.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def DownloadRef(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/ocellus.OcellusModuleService/DownloadRef',
            ocellus__module__service__pb2.DownloadRefRequest.SerializeToString,
            ocellus__module__service__pb2.DownloadRefResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
