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

import grpc
import warnings

import histserv.protos.hist_pb2 as hist__pb2

GRPC_GENERATED_VERSION = "1.78.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},"
        + " but the generated code in hist_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 HistogrammerServiceStub(object):
    """The histogram service definition."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.Init = channel.unary_unary(
            "/HistogrammerService/Init",
            request_serializer=hist__pb2.InitRequest.SerializeToString,
            response_deserializer=hist__pb2.InitResponse.FromString,
            _registered_method=True,
        )
        self.Fill = channel.unary_unary(
            "/HistogrammerService/Fill",
            request_serializer=hist__pb2.FillRequest.SerializeToString,
            response_deserializer=hist__pb2.FillResponse.FromString,
            _registered_method=True,
        )
        self.SnapShot = channel.unary_unary(
            "/HistogrammerService/SnapShot",
            request_serializer=hist__pb2.SnapShotRequest.SerializeToString,
            response_deserializer=hist__pb2.SnapShotResponse.FromString,
            _registered_method=True,
        )
        self.Flush = channel.unary_unary(
            "/HistogrammerService/Flush",
            request_serializer=hist__pb2.FlushRequest.SerializeToString,
            response_deserializer=hist__pb2.FlushResponse.FromString,
            _registered_method=True,
        )


class HistogrammerServiceServicer(object):
    """The histogram service definition."""

    def Init(self, request, context):
        """Sends a histogram initialization request"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def Fill(self, request, context):
        """Sends a filling request"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SnapShot(self, request, context):
        """Sends a snapshot request of the current histogram"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def Flush(self, request, context):
        """Sends a flushing request (to disk)"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_HistogrammerServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "Init": grpc.unary_unary_rpc_method_handler(
            servicer.Init,
            request_deserializer=hist__pb2.InitRequest.FromString,
            response_serializer=hist__pb2.InitResponse.SerializeToString,
        ),
        "Fill": grpc.unary_unary_rpc_method_handler(
            servicer.Fill,
            request_deserializer=hist__pb2.FillRequest.FromString,
            response_serializer=hist__pb2.FillResponse.SerializeToString,
        ),
        "SnapShot": grpc.unary_unary_rpc_method_handler(
            servicer.SnapShot,
            request_deserializer=hist__pb2.SnapShotRequest.FromString,
            response_serializer=hist__pb2.SnapShotResponse.SerializeToString,
        ),
        "Flush": grpc.unary_unary_rpc_method_handler(
            servicer.Flush,
            request_deserializer=hist__pb2.FlushRequest.FromString,
            response_serializer=hist__pb2.FlushResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "HistogrammerService", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers("HistogrammerService", rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class HistogrammerService(object):
    """The histogram service definition."""

    @staticmethod
    def Init(
        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,
            "/HistogrammerService/Init",
            hist__pb2.InitRequest.SerializeToString,
            hist__pb2.InitResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def Fill(
        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,
            "/HistogrammerService/Fill",
            hist__pb2.FillRequest.SerializeToString,
            hist__pb2.FillResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def SnapShot(
        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,
            "/HistogrammerService/SnapShot",
            hist__pb2.SnapShotRequest.SerializeToString,
            hist__pb2.SnapShotResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def Flush(
        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,
            "/HistogrammerService/Flush",
            hist__pb2.FlushRequest.SerializeToString,
            hist__pb2.FlushResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )
