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

from avikom.generic import peer_pb2 as avikom_dot_generic_dot_peer__pb2
from avikom.generic import peer_storage_service_pb2 as avikom_dot_generic_dot_peer__storage__service__pb2
from avikom.generic import result_pb2 as avikom_dot_generic_dot_result__pb2
from avikom.generic import user_pb2 as avikom_dot_generic_dot_user__pb2


class PeerStorageServiceStub(object):
    """*
    Peer management service to make service ip/hostname mappings persistent over
    multiple sessions. The peer storage service is implemented in services and database.
    Only session managers should use this interface for updates and deletions. Other services
    should only access this service to retrieve information.
    @author Alexander Neumann <alneuman@techfak.uni-bielefeld.de>
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.UpdatePeer = channel.unary_unary(
                '/avikom.generic.PeerStorageService/UpdatePeer',
                request_serializer=avikom_dot_generic_dot_peer__pb2.Peer.SerializeToString,
                response_deserializer=avikom_dot_generic_dot_result__pb2.Result.FromString,
                )
        self.GetPeer = channel.unary_unary(
                '/avikom.generic.PeerStorageService/GetPeer',
                request_serializer=avikom_dot_generic_dot_peer__storage__service__pb2.PeerStorageQuery.SerializeToString,
                response_deserializer=avikom_dot_generic_dot_peer__pb2.Peer.FromString,
                )
        self.GetUserPeers = channel.unary_unary(
                '/avikom.generic.PeerStorageService/GetUserPeers',
                request_serializer=avikom_dot_generic_dot_user__pb2.User.SerializeToString,
                response_deserializer=avikom_dot_generic_dot_peer__pb2.PeerList.FromString,
                )
        self.DeletePeer = channel.unary_unary(
                '/avikom.generic.PeerStorageService/DeletePeer',
                request_serializer=avikom_dot_generic_dot_peer__storage__service__pb2.PeerStorageQuery.SerializeToString,
                response_deserializer=avikom_dot_generic_dot_result__pb2.Result.FromString,
                )


class PeerStorageServiceServicer(object):
    """*
    Peer management service to make service ip/hostname mappings persistent over
    multiple sessions. The peer storage service is implemented in services and database.
    Only session managers should use this interface for updates and deletions. Other services
    should only access this service to retrieve information.
    @author Alexander Neumann <alneuman@techfak.uni-bielefeld.de>
    """

    def UpdatePeer(self, request, context):
        """/ updates peer information; requires peer.name; creates new peer if peer.name does not exist. This should not be called by peers directly! Use SessionService.RegisterUserPeer instead.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetPeer(self, request, context):
        """/ returns the Peer matching the name provided in the query if peer exists
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetUserPeers(self, request, context):
        """/ returns list of all peers that are registered to the user_id of "User"
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeletePeer(self, request, context):
        """/ deletes the Peer from the database, returns error if peer not found
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PeerStorageServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'UpdatePeer': grpc.unary_unary_rpc_method_handler(
                    servicer.UpdatePeer,
                    request_deserializer=avikom_dot_generic_dot_peer__pb2.Peer.FromString,
                    response_serializer=avikom_dot_generic_dot_result__pb2.Result.SerializeToString,
            ),
            'GetPeer': grpc.unary_unary_rpc_method_handler(
                    servicer.GetPeer,
                    request_deserializer=avikom_dot_generic_dot_peer__storage__service__pb2.PeerStorageQuery.FromString,
                    response_serializer=avikom_dot_generic_dot_peer__pb2.Peer.SerializeToString,
            ),
            'GetUserPeers': grpc.unary_unary_rpc_method_handler(
                    servicer.GetUserPeers,
                    request_deserializer=avikom_dot_generic_dot_user__pb2.User.FromString,
                    response_serializer=avikom_dot_generic_dot_peer__pb2.PeerList.SerializeToString,
            ),
            'DeletePeer': grpc.unary_unary_rpc_method_handler(
                    servicer.DeletePeer,
                    request_deserializer=avikom_dot_generic_dot_peer__storage__service__pb2.PeerStorageQuery.FromString,
                    response_serializer=avikom_dot_generic_dot_result__pb2.Result.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'avikom.generic.PeerStorageService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class PeerStorageService(object):
    """*
    Peer management service to make service ip/hostname mappings persistent over
    multiple sessions. The peer storage service is implemented in services and database.
    Only session managers should use this interface for updates and deletions. Other services
    should only access this service to retrieve information.
    @author Alexander Neumann <alneuman@techfak.uni-bielefeld.de>
    """

    @staticmethod
    def UpdatePeer(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, '/avikom.generic.PeerStorageService/UpdatePeer',
            avikom_dot_generic_dot_peer__pb2.Peer.SerializeToString,
            avikom_dot_generic_dot_result__pb2.Result.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetPeer(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, '/avikom.generic.PeerStorageService/GetPeer',
            avikom_dot_generic_dot_peer__storage__service__pb2.PeerStorageQuery.SerializeToString,
            avikom_dot_generic_dot_peer__pb2.Peer.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetUserPeers(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, '/avikom.generic.PeerStorageService/GetUserPeers',
            avikom_dot_generic_dot_user__pb2.User.SerializeToString,
            avikom_dot_generic_dot_peer__pb2.PeerList.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def DeletePeer(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, '/avikom.generic.PeerStorageService/DeletePeer',
            avikom_dot_generic_dot_peer__storage__service__pb2.PeerStorageQuery.SerializeToString,
            avikom_dot_generic_dot_result__pb2.Result.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
