from __future__ import absolute_import
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
from builtins import object
import grpc

from . import beam_fn_api_pb2 as beam__fn__api__pb2


class BeamFnControlStub(object):
  """
  Control Plane API

  Progress reporting and splitting still need further vetting. Also, this may
  change with the addition of new types of instructions/responses related to
  metrics.

  An API that describes the work that a SDK harness is meant to do.
  Stable
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.Control = channel.stream_stream(
        '/org.apache.beam.model.fn_execution.v1.BeamFnControl/Control',
        request_serializer=beam__fn__api__pb2.InstructionResponse.SerializeToString,
        response_deserializer=beam__fn__api__pb2.InstructionRequest.FromString,
        )
    self.GetProcessBundleDescriptor = channel.unary_unary(
        '/org.apache.beam.model.fn_execution.v1.BeamFnControl/GetProcessBundleDescriptor',
        request_serializer=beam__fn__api__pb2.GetProcessBundleDescriptorRequest.SerializeToString,
        response_deserializer=beam__fn__api__pb2.ProcessBundleDescriptor.FromString,
        )


class BeamFnControlServicer(object):
  """
  Control Plane API

  Progress reporting and splitting still need further vetting. Also, this may
  change with the addition of new types of instructions/responses related to
  metrics.

  An API that describes the work that a SDK harness is meant to do.
  Stable
  """

  def Control(self, request_iterator, context):
    """Instructions sent by the runner to the SDK requesting different types
    of work.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetProcessBundleDescriptor(self, request, context):
    """Used to get the full process bundle descriptors for bundles one
    is asked to process.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BeamFnControlServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Control': grpc.stream_stream_rpc_method_handler(
          servicer.Control,
          request_deserializer=beam__fn__api__pb2.InstructionResponse.FromString,
          response_serializer=beam__fn__api__pb2.InstructionRequest.SerializeToString,
      ),
      'GetProcessBundleDescriptor': grpc.unary_unary_rpc_method_handler(
          servicer.GetProcessBundleDescriptor,
          request_deserializer=beam__fn__api__pb2.GetProcessBundleDescriptorRequest.FromString,
          response_serializer=beam__fn__api__pb2.ProcessBundleDescriptor.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'org.apache.beam.model.fn_execution.v1.BeamFnControl', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


class BeamFnDataStub(object):
  """Stable
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.Data = channel.stream_stream(
        '/org.apache.beam.model.fn_execution.v1.BeamFnData/Data',
        request_serializer=beam__fn__api__pb2.Elements.SerializeToString,
        response_deserializer=beam__fn__api__pb2.Elements.FromString,
        )


class BeamFnDataServicer(object):
  """Stable
  """

  def Data(self, request_iterator, context):
    """Used to send data between harnesses.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BeamFnDataServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Data': grpc.stream_stream_rpc_method_handler(
          servicer.Data,
          request_deserializer=beam__fn__api__pb2.Elements.FromString,
          response_serializer=beam__fn__api__pb2.Elements.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'org.apache.beam.model.fn_execution.v1.BeamFnData', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


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

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

    Args:
      channel: A grpc.Channel.
    """
    self.State = channel.stream_stream(
        '/org.apache.beam.model.fn_execution.v1.BeamFnState/State',
        request_serializer=beam__fn__api__pb2.StateRequest.SerializeToString,
        response_deserializer=beam__fn__api__pb2.StateResponse.FromString,
        )


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

  def State(self, request_iterator, context):
    """Used to get/append/clear state stored by the runner on behalf of the SDK.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BeamFnStateServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'State': grpc.stream_stream_rpc_method_handler(
          servicer.State,
          request_deserializer=beam__fn__api__pb2.StateRequest.FromString,
          response_serializer=beam__fn__api__pb2.StateResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'org.apache.beam.model.fn_execution.v1.BeamFnState', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


class BeamFnLoggingStub(object):
  """Stable
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.Logging = channel.stream_stream(
        '/org.apache.beam.model.fn_execution.v1.BeamFnLogging/Logging',
        request_serializer=beam__fn__api__pb2.LogEntry.List.SerializeToString,
        response_deserializer=beam__fn__api__pb2.LogControl.FromString,
        )


class BeamFnLoggingServicer(object):
  """Stable
  """

  def Logging(self, request_iterator, context):
    """Allows for the SDK to emit log entries which the runner can
    associate with the active job.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BeamFnLoggingServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Logging': grpc.stream_stream_rpc_method_handler(
          servicer.Logging,
          request_deserializer=beam__fn__api__pb2.LogEntry.List.FromString,
          response_serializer=beam__fn__api__pb2.LogControl.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'org.apache.beam.model.fn_execution.v1.BeamFnLogging', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


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

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

    Args:
      channel: A grpc.Channel.
    """
    self.StartWorker = channel.unary_unary(
        '/org.apache.beam.model.fn_execution.v1.BeamFnExternalWorkerPool/StartWorker',
        request_serializer=beam__fn__api__pb2.StartWorkerRequest.SerializeToString,
        response_deserializer=beam__fn__api__pb2.StartWorkerResponse.FromString,
        )
    self.StopWorker = channel.unary_unary(
        '/org.apache.beam.model.fn_execution.v1.BeamFnExternalWorkerPool/StopWorker',
        request_serializer=beam__fn__api__pb2.StopWorkerRequest.SerializeToString,
        response_deserializer=beam__fn__api__pb2.StopWorkerResponse.FromString,
        )


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

  def StartWorker(self, request, context):
    """Start the SDK worker with the given ID.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def StopWorker(self, request, context):
    """Stop the SDK worker.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BeamFnExternalWorkerPoolServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'StartWorker': grpc.unary_unary_rpc_method_handler(
          servicer.StartWorker,
          request_deserializer=beam__fn__api__pb2.StartWorkerRequest.FromString,
          response_serializer=beam__fn__api__pb2.StartWorkerResponse.SerializeToString,
      ),
      'StopWorker': grpc.unary_unary_rpc_method_handler(
          servicer.StopWorker,
          request_deserializer=beam__fn__api__pb2.StopWorkerRequest.FromString,
          response_serializer=beam__fn__api__pb2.StopWorkerResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'org.apache.beam.model.fn_execution.v1.BeamFnExternalWorkerPool', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


class BeamFnWorkerStatusStub(object):
  """API for SDKs to report debug-related statuses to runner during pipeline execution.
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.WorkerStatus = channel.stream_stream(
        '/org.apache.beam.model.fn_execution.v1.BeamFnWorkerStatus/WorkerStatus',
        request_serializer=beam__fn__api__pb2.WorkerStatusResponse.SerializeToString,
        response_deserializer=beam__fn__api__pb2.WorkerStatusRequest.FromString,
        )


class BeamFnWorkerStatusServicer(object):
  """API for SDKs to report debug-related statuses to runner during pipeline execution.
  """

  def WorkerStatus(self, request_iterator, context):
    # missing associated documentation comment in .proto file
    pass
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BeamFnWorkerStatusServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'WorkerStatus': grpc.stream_stream_rpc_method_handler(
          servicer.WorkerStatus,
          request_deserializer=beam__fn__api__pb2.WorkerStatusResponse.FromString,
          response_serializer=beam__fn__api__pb2.WorkerStatusRequest.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'org.apache.beam.model.fn_execution.v1.BeamFnWorkerStatus', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
