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

from agntcy.dir.routing.v1 import routing_service_pb2 as agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class RoutingServiceStub(object):
    """Defines an interface for announcement and discovery
    of records across interconnected network.

    Middleware should be used to control who can perform these RPCs.
    Policies for the middleware can be handled via separate service.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Publish = channel.unary_unary(
                '/agntcy.dir.routing.v1.RoutingService/Publish',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.PublishRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.Unpublish = channel.unary_unary(
                '/agntcy.dir.routing.v1.RoutingService/Unpublish',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.UnpublishRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.Search = channel.unary_stream(
                '/agntcy.dir.routing.v1.RoutingService/Search',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.SearchRequest.SerializeToString,
                response_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.SearchResponse.FromString,
                _registered_method=True)
        self.List = channel.unary_stream(
                '/agntcy.dir.routing.v1.RoutingService/List',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.ListRequest.SerializeToString,
                response_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.ListResponse.FromString,
                _registered_method=True)


class RoutingServiceServicer(object):
    """Defines an interface for announcement and discovery
    of records across interconnected network.

    Middleware should be used to control who can perform these RPCs.
    Policies for the middleware can be handled via separate service.
    """

    def Publish(self, request, context):
        """Announce to the network that this peer is providing a given record.
        This enables other peers to discover this record and retrieve it
        from this peer. Listeners can use this event to perform custom operations,
        for example by cloning the record.

        Items need to be periodically republished (eg. 24h) to the network
        to avoid stale data. Republication should be done in the background.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Unpublish(self, request, context):
        """Stop serving this record to the network. If other peers try
        to retrieve this record, the peer will refuse the request.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Search(self, request, context):
        """Search records based on the request across the network.
        This will search the network for the record with the given parameters.

        It is possible that the records are stale or that they do not exist.
        Some records may be provided by multiple peers.

        Results from the search can be used as an input
        to Pull operation to retrieve the records.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def List(self, request, context):
        """List all records that this peer is currently providing
        that match the given parameters.
        This operation does not interact with the network.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_RoutingServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Publish': grpc.unary_unary_rpc_method_handler(
                    servicer.Publish,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.PublishRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'Unpublish': grpc.unary_unary_rpc_method_handler(
                    servicer.Unpublish,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.UnpublishRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'Search': grpc.unary_stream_rpc_method_handler(
                    servicer.Search,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.SearchRequest.FromString,
                    response_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.SearchResponse.SerializeToString,
            ),
            'List': grpc.unary_stream_rpc_method_handler(
                    servicer.List,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.ListRequest.FromString,
                    response_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.ListResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'agntcy.dir.routing.v1.RoutingService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('agntcy.dir.routing.v1.RoutingService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class RoutingService(object):
    """Defines an interface for announcement and discovery
    of records across interconnected network.

    Middleware should be used to control who can perform these RPCs.
    Policies for the middleware can be handled via separate service.
    """

    @staticmethod
    def Publish(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,
            '/agntcy.dir.routing.v1.RoutingService/Publish',
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.PublishRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Unpublish(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,
            '/agntcy.dir.routing.v1.RoutingService/Unpublish',
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.UnpublishRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Search(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_stream(
            request,
            target,
            '/agntcy.dir.routing.v1.RoutingService/Search',
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.SearchRequest.SerializeToString,
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.SearchResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def List(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_stream(
            request,
            target,
            '/agntcy.dir.routing.v1.RoutingService/List',
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.ListRequest.SerializeToString,
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.ListResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
