# 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 . import observability_pb2 as observability__pb2

GRPC_GENERATED_VERSION = '1.76.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 observability_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 ObservabilityStub(object):
    """Main observability service for event registration and graph queries
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.RegisterEvents = channel.unary_unary(
                '/observability.Observability/RegisterEvents',
                request_serializer=observability__pb2.Events.SerializeToString,
                response_deserializer=observability__pb2.IDs.FromString,
                _registered_method=True)
        self.RegisterDependencies = channel.unary_unary(
                '/observability.Observability/RegisterDependencies',
                request_serializer=observability__pb2.Dependencies.SerializeToString,
                response_deserializer=observability__pb2.Response.FromString,
                _registered_method=True)
        self.BackwardSlice = channel.unary_unary(
                '/observability.Observability/BackwardSlice',
                request_serializer=observability__pb2.SliceRequest.SerializeToString,
                response_deserializer=observability__pb2.Graph.FromString,
                _registered_method=True)
        self.ForwardSlice = channel.unary_unary(
                '/observability.Observability/ForwardSlice',
                request_serializer=observability__pb2.SliceRequest.SerializeToString,
                response_deserializer=observability__pb2.Graph.FromString,
                _registered_method=True)
        self.RegisterComputations = channel.unary_unary(
                '/observability.Observability/RegisterComputations',
                request_serializer=observability__pb2.Computations.SerializeToString,
                response_deserializer=observability__pb2.IDs.FromString,
                _registered_method=True)
        self.GetTrace = channel.unary_unary(
                '/observability.Observability/GetTrace',
                request_serializer=observability__pb2.TraceRequest.SerializeToString,
                response_deserializer=observability__pb2.TraceGraph.FromString,
                _registered_method=True)
        self.GetSpan = channel.unary_unary(
                '/observability.Observability/GetSpan',
                request_serializer=observability__pb2.SpanRequest.SerializeToString,
                response_deserializer=observability__pb2.Computation.FromString,
                _registered_method=True)


class ObservabilityServicer(object):
    """Main observability service for event registration and graph queries
    """

    def RegisterEvents(self, request, context):
        """Message/Event operations (existing)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RegisterDependencies(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def BackwardSlice(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ForwardSlice(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RegisterComputations(self, request, context):
        """Computation/Span operations (new - OpenTelemetry)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetTrace(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetSpan(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ObservabilityServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'RegisterEvents': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterEvents,
                    request_deserializer=observability__pb2.Events.FromString,
                    response_serializer=observability__pb2.IDs.SerializeToString,
            ),
            'RegisterDependencies': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterDependencies,
                    request_deserializer=observability__pb2.Dependencies.FromString,
                    response_serializer=observability__pb2.Response.SerializeToString,
            ),
            'BackwardSlice': grpc.unary_unary_rpc_method_handler(
                    servicer.BackwardSlice,
                    request_deserializer=observability__pb2.SliceRequest.FromString,
                    response_serializer=observability__pb2.Graph.SerializeToString,
            ),
            'ForwardSlice': grpc.unary_unary_rpc_method_handler(
                    servicer.ForwardSlice,
                    request_deserializer=observability__pb2.SliceRequest.FromString,
                    response_serializer=observability__pb2.Graph.SerializeToString,
            ),
            'RegisterComputations': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterComputations,
                    request_deserializer=observability__pb2.Computations.FromString,
                    response_serializer=observability__pb2.IDs.SerializeToString,
            ),
            'GetTrace': grpc.unary_unary_rpc_method_handler(
                    servicer.GetTrace,
                    request_deserializer=observability__pb2.TraceRequest.FromString,
                    response_serializer=observability__pb2.TraceGraph.SerializeToString,
            ),
            'GetSpan': grpc.unary_unary_rpc_method_handler(
                    servicer.GetSpan,
                    request_deserializer=observability__pb2.SpanRequest.FromString,
                    response_serializer=observability__pb2.Computation.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'observability.Observability', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('observability.Observability', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Observability(object):
    """Main observability service for event registration and graph queries
    """

    @staticmethod
    def RegisterEvents(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,
            '/observability.Observability/RegisterEvents',
            observability__pb2.Events.SerializeToString,
            observability__pb2.IDs.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RegisterDependencies(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,
            '/observability.Observability/RegisterDependencies',
            observability__pb2.Dependencies.SerializeToString,
            observability__pb2.Response.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def BackwardSlice(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,
            '/observability.Observability/BackwardSlice',
            observability__pb2.SliceRequest.SerializeToString,
            observability__pb2.Graph.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ForwardSlice(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,
            '/observability.Observability/ForwardSlice',
            observability__pb2.SliceRequest.SerializeToString,
            observability__pb2.Graph.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RegisterComputations(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,
            '/observability.Observability/RegisterComputations',
            observability__pb2.Computations.SerializeToString,
            observability__pb2.IDs.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetTrace(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,
            '/observability.Observability/GetTrace',
            observability__pb2.TraceRequest.SerializeToString,
            observability__pb2.TraceGraph.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetSpan(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,
            '/observability.Observability/GetSpan',
            observability__pb2.SpanRequest.SerializeToString,
            observability__pb2.Computation.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)


class ObservabilityUpdatesStub(object):
    """Updates service for graph state streaming
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetState = channel.unary_unary(
                '/observability.ObservabilityUpdates/GetState',
                request_serializer=observability__pb2.StateRequest.SerializeToString,
                response_deserializer=observability__pb2.GraphState.FromString,
                _registered_method=True)
        self.StreamUpdates = channel.stream_stream(
                '/observability.ObservabilityUpdates/StreamUpdates',
                request_serializer=observability__pb2.StreamMessage.SerializeToString,
                response_deserializer=observability__pb2.GraphUpdates.FromString,
                _registered_method=True)


class ObservabilityUpdatesServicer(object):
    """Updates service for graph state streaming
    """

    def GetState(self, request, context):
        """Get current graph state
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamUpdates(self, request_iterator, context):
        """Bidirectional stream: client sends StreamMessage (subscribe/ack), server sends batched updates
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ObservabilityUpdatesServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetState': grpc.unary_unary_rpc_method_handler(
                    servicer.GetState,
                    request_deserializer=observability__pb2.StateRequest.FromString,
                    response_serializer=observability__pb2.GraphState.SerializeToString,
            ),
            'StreamUpdates': grpc.stream_stream_rpc_method_handler(
                    servicer.StreamUpdates,
                    request_deserializer=observability__pb2.StreamMessage.FromString,
                    response_serializer=observability__pb2.GraphUpdates.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'observability.ObservabilityUpdates', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('observability.ObservabilityUpdates', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class ObservabilityUpdates(object):
    """Updates service for graph state streaming
    """

    @staticmethod
    def GetState(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,
            '/observability.ObservabilityUpdates/GetState',
            observability__pb2.StateRequest.SerializeToString,
            observability__pb2.GraphState.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamUpdates(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,
            '/observability.ObservabilityUpdates/StreamUpdates',
            observability__pb2.StreamMessage.SerializeToString,
            observability__pb2.GraphUpdates.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
