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

from sdv.databroker.v1 import collector_pb2 as sdv_dot_databroker_dot_v1_dot_collector__pb2

GRPC_GENERATED_VERSION = '1.68.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in sdv/databroker/v1/collector_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class CollectorStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.RegisterDatapoints = channel.unary_unary(
                '/sdv.databroker.v1.Collector/RegisterDatapoints',
                request_serializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.RegisterDatapointsRequest.SerializeToString,
                response_deserializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.RegisterDatapointsReply.FromString,
                _registered_method=True)
        self.UpdateDatapoints = channel.unary_unary(
                '/sdv.databroker.v1.Collector/UpdateDatapoints',
                request_serializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.UpdateDatapointsRequest.SerializeToString,
                response_deserializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.UpdateDatapointsReply.FromString,
                _registered_method=True)
        self.StreamDatapoints = channel.stream_stream(
                '/sdv.databroker.v1.Collector/StreamDatapoints',
                request_serializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.StreamDatapointsRequest.SerializeToString,
                response_deserializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.StreamDatapointsReply.FromString,
                _registered_method=True)


class CollectorServicer(object):
    """Missing associated documentation comment in .proto file."""

    def RegisterDatapoints(self, request, context):
        """Register new datapoint (metadata)

        If the registration of at least one of the passed data point fails, the overall registration
        is rejected and the gRPC status code ABORTED is returned (to indicate the "aborted" registration).
        The details, which data point(s) caused the failure and the reason, is passed in back in human-
        readable form in the status message. Possible failure resaons are:
        * PERMISSION_DENIED - Not allowed to register this name
        * ALREADY_REGISTERED - The data point is already registered by some other feeder
        * RE_REGISTRATION_MISMATCH - Already registered by this feeder but with differing metadata
        * INVALID_NAME - The passed name of the datapoint has an invalid structure
        * INVALID_VALUE_TYPE - The passed ValueType is not supported
        * INVALID_CHANGE_TYPE - The passed ChangeType is not supported
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UpdateDatapoints(self, request, context):
        """Provide a set of updated datapoint values to the broker.
        This is the unary equivalent of `StreamDatapoints` below and is better suited for cases
        where the frequency of updates is rather low.

        NOTE: The values provided in a single request are handled as a single update in the
        data broker. This ensures that any clients requesting (or subscribing to) a set of
        datapoints will get a consistent update, i.e. that either all values are updated or
        none are.

        Returns: any errors encountered updating the datapoints

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

    def StreamDatapoints(self, request_iterator, context):
        """Provide a stream with updated datapoint values to the broker.
        This is the streaming equivalent of `UpdateDatapoints` above and is better suited for
        cases where the frequency of updates is high.

        NOTE: The values provided in a single request are handled as a single update in the
        data broker. This ensures that any clients requesting (or subscribing to) a set of
        datapoints will get a consistent update, i.e. that either all values are updated or
        none are.

        Returns: any errors encountered updating the datapoints

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


def add_CollectorServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'RegisterDatapoints': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterDatapoints,
                    request_deserializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.RegisterDatapointsRequest.FromString,
                    response_serializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.RegisterDatapointsReply.SerializeToString,
            ),
            'UpdateDatapoints': grpc.unary_unary_rpc_method_handler(
                    servicer.UpdateDatapoints,
                    request_deserializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.UpdateDatapointsRequest.FromString,
                    response_serializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.UpdateDatapointsReply.SerializeToString,
            ),
            'StreamDatapoints': grpc.stream_stream_rpc_method_handler(
                    servicer.StreamDatapoints,
                    request_deserializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.StreamDatapointsRequest.FromString,
                    response_serializer=sdv_dot_databroker_dot_v1_dot_collector__pb2.StreamDatapointsReply.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'sdv.databroker.v1.Collector', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('sdv.databroker.v1.Collector', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Collector(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def RegisterDatapoints(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,
            '/sdv.databroker.v1.Collector/RegisterDatapoints',
            sdv_dot_databroker_dot_v1_dot_collector__pb2.RegisterDatapointsRequest.SerializeToString,
            sdv_dot_databroker_dot_v1_dot_collector__pb2.RegisterDatapointsReply.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def UpdateDatapoints(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,
            '/sdv.databroker.v1.Collector/UpdateDatapoints',
            sdv_dot_databroker_dot_v1_dot_collector__pb2.UpdateDatapointsRequest.SerializeToString,
            sdv_dot_databroker_dot_v1_dot_collector__pb2.UpdateDatapointsReply.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamDatapoints(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,
            '/sdv.databroker.v1.Collector/StreamDatapoints',
            sdv_dot_databroker_dot_v1_dot_collector__pb2.StreamDatapointsRequest.SerializeToString,
            sdv_dot_databroker_dot_v1_dot_collector__pb2.StreamDatapointsReply.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
