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

from utxorpc_spec.utxorpc.v1alpha.sync import sync_pb2 as utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2


class SyncServiceStub(object):
    """Service definition for syncing chain data.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.FetchBlock = channel.unary_unary(
                '/utxorpc.v1alpha.sync.SyncService/FetchBlock',
                request_serializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FetchBlockRequest.SerializeToString,
                response_deserializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FetchBlockResponse.FromString,
                _registered_method=True)
        self.DumpHistory = channel.unary_unary(
                '/utxorpc.v1alpha.sync.SyncService/DumpHistory',
                request_serializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.DumpHistoryRequest.SerializeToString,
                response_deserializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.DumpHistoryResponse.FromString,
                _registered_method=True)
        self.FollowTip = channel.unary_stream(
                '/utxorpc.v1alpha.sync.SyncService/FollowTip',
                request_serializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FollowTipRequest.SerializeToString,
                response_deserializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FollowTipResponse.FromString,
                _registered_method=True)


class SyncServiceServicer(object):
    """Service definition for syncing chain data.
    """

    def FetchBlock(self, request, context):
        """Fetch a block by its reference.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DumpHistory(self, request, context):
        """Dump the block history.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def FollowTip(self, request, context):
        """Follow the tip of the blockchain.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SyncServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'FetchBlock': grpc.unary_unary_rpc_method_handler(
                    servicer.FetchBlock,
                    request_deserializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FetchBlockRequest.FromString,
                    response_serializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FetchBlockResponse.SerializeToString,
            ),
            'DumpHistory': grpc.unary_unary_rpc_method_handler(
                    servicer.DumpHistory,
                    request_deserializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.DumpHistoryRequest.FromString,
                    response_serializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.DumpHistoryResponse.SerializeToString,
            ),
            'FollowTip': grpc.unary_stream_rpc_method_handler(
                    servicer.FollowTip,
                    request_deserializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FollowTipRequest.FromString,
                    response_serializer=utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FollowTipResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'utxorpc.v1alpha.sync.SyncService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('utxorpc.v1alpha.sync.SyncService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class SyncService(object):
    """Service definition for syncing chain data.
    """

    @staticmethod
    def FetchBlock(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,
            '/utxorpc.v1alpha.sync.SyncService/FetchBlock',
            utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FetchBlockRequest.SerializeToString,
            utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FetchBlockResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DumpHistory(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,
            '/utxorpc.v1alpha.sync.SyncService/DumpHistory',
            utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.DumpHistoryRequest.SerializeToString,
            utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.DumpHistoryResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def FollowTip(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,
            '/utxorpc.v1alpha.sync.SyncService/FollowTip',
            utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FollowTipRequest.SerializeToString,
            utxorpc_dot_v1alpha_dot_sync_dot_sync__pb2.FollowTipResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
