# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from . import consensus_pb2 as consensus__pb2
from . import empty_pb2 as empty__pb2
from . import gossiping_pb2 as gossiping__pb2


class GossipServiceStub(object):
  # missing associated documentation comment in .proto file
  pass

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

    Args:
      channel: A grpc.Channel.
    """
    self.NewBlocks = channel.unary_unary(
        '/io.casperlabs.comm.gossiping.GossipService/NewBlocks',
        request_serializer=gossiping__pb2.NewBlocksRequest.SerializeToString,
        response_deserializer=gossiping__pb2.NewBlocksResponse.FromString,
        )
    self.StreamAncestorBlockSummaries = channel.unary_stream(
        '/io.casperlabs.comm.gossiping.GossipService/StreamAncestorBlockSummaries',
        request_serializer=gossiping__pb2.StreamAncestorBlockSummariesRequest.SerializeToString,
        response_deserializer=consensus__pb2.BlockSummary.FromString,
        )
    self.StreamDagTipBlockSummaries = channel.unary_stream(
        '/io.casperlabs.comm.gossiping.GossipService/StreamDagTipBlockSummaries',
        request_serializer=gossiping__pb2.StreamDagTipBlockSummariesRequest.SerializeToString,
        response_deserializer=consensus__pb2.BlockSummary.FromString,
        )
    self.StreamBlockSummaries = channel.unary_stream(
        '/io.casperlabs.comm.gossiping.GossipService/StreamBlockSummaries',
        request_serializer=gossiping__pb2.StreamBlockSummariesRequest.SerializeToString,
        response_deserializer=consensus__pb2.BlockSummary.FromString,
        )
    self.GetBlockChunked = channel.unary_stream(
        '/io.casperlabs.comm.gossiping.GossipService/GetBlockChunked',
        request_serializer=gossiping__pb2.GetBlockChunkedRequest.SerializeToString,
        response_deserializer=gossiping__pb2.Chunk.FromString,
        )
    self.GetGenesisCandidate = channel.unary_unary(
        '/io.casperlabs.comm.gossiping.GossipService/GetGenesisCandidate',
        request_serializer=gossiping__pb2.GetGenesisCandidateRequest.SerializeToString,
        response_deserializer=consensus__pb2.GenesisCandidate.FromString,
        )
    self.AddApproval = channel.unary_unary(
        '/io.casperlabs.comm.gossiping.GossipService/AddApproval',
        request_serializer=gossiping__pb2.AddApprovalRequest.SerializeToString,
        response_deserializer=empty__pb2.Empty.FromString,
        )


class GossipServiceServicer(object):
  # missing associated documentation comment in .proto file
  pass

  def NewBlocks(self, request, context):
    """Notify the callee about new blocks being available on the caller.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def StreamAncestorBlockSummaries(self, request, context):
    """Retrieve the ancestors of certain blocks in the DAG; to be called repeatedly
    as necessary to synchronize DAGs between peers.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def StreamDagTipBlockSummaries(self, request, context):
    """Retrieve the tips of the DAG as the callee knows them, to kick off synchronization between peers.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def StreamBlockSummaries(self, request, context):
    """Retrieve arbitrary block summaries, if the callee knows about them.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetBlockChunked(self, request, context):
    """Retrieve an arbitrarily sized block as a stream of chunks, with optionally compressed content.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetGenesisCandidate(self, request, context):
    """Retrieve the Genesis candidate supported by this node. Every node should either produce one from specification,
    get one from its bootstrap, or have it persisted from earlier runs.
    While the node is initializing and it hasn't obtained the candidate yet it will return UNAVAILABLE.
    Once the node is serving a candidate identity, it should also be prepared to serve the full block on request.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def AddApproval(self, request, context):
    """Add a signature to the list of approvals of a given candidate. If the block hash in the request doesn't match
    the callee's candidate it will return INVALID_ARGUMENT, otherwise add the signature and forward it to its peers.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_GossipServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'NewBlocks': grpc.unary_unary_rpc_method_handler(
          servicer.NewBlocks,
          request_deserializer=gossiping__pb2.NewBlocksRequest.FromString,
          response_serializer=gossiping__pb2.NewBlocksResponse.SerializeToString,
      ),
      'StreamAncestorBlockSummaries': grpc.unary_stream_rpc_method_handler(
          servicer.StreamAncestorBlockSummaries,
          request_deserializer=gossiping__pb2.StreamAncestorBlockSummariesRequest.FromString,
          response_serializer=consensus__pb2.BlockSummary.SerializeToString,
      ),
      'StreamDagTipBlockSummaries': grpc.unary_stream_rpc_method_handler(
          servicer.StreamDagTipBlockSummaries,
          request_deserializer=gossiping__pb2.StreamDagTipBlockSummariesRequest.FromString,
          response_serializer=consensus__pb2.BlockSummary.SerializeToString,
      ),
      'StreamBlockSummaries': grpc.unary_stream_rpc_method_handler(
          servicer.StreamBlockSummaries,
          request_deserializer=gossiping__pb2.StreamBlockSummariesRequest.FromString,
          response_serializer=consensus__pb2.BlockSummary.SerializeToString,
      ),
      'GetBlockChunked': grpc.unary_stream_rpc_method_handler(
          servicer.GetBlockChunked,
          request_deserializer=gossiping__pb2.GetBlockChunkedRequest.FromString,
          response_serializer=gossiping__pb2.Chunk.SerializeToString,
      ),
      'GetGenesisCandidate': grpc.unary_unary_rpc_method_handler(
          servicer.GetGenesisCandidate,
          request_deserializer=gossiping__pb2.GetGenesisCandidateRequest.FromString,
          response_serializer=consensus__pb2.GenesisCandidate.SerializeToString,
      ),
      'AddApproval': grpc.unary_unary_rpc_method_handler(
          servicer.AddApproval,
          request_deserializer=gossiping__pb2.AddApprovalRequest.FromString,
          response_serializer=empty__pb2.Empty.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'io.casperlabs.comm.gossiping.GossipService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
