# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
from __future__ import absolute_import
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,))


 # This class is part of an EXPERIMENTAL API.
class BeamFnControl(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
    """

    @staticmethod
    def Control(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/org.apache.beam.model.fn_execution.v1.BeamFnControl/Control',
            beam__fn__api__pb2.InstructionResponse.SerializeToString,
            beam__fn__api__pb2.InstructionRequest.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetProcessBundleDescriptor(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, '/org.apache.beam.model.fn_execution.v1.BeamFnControl/GetProcessBundleDescriptor',
            beam__fn__api__pb2.GetProcessBundleDescriptorRequest.SerializeToString,
            beam__fn__api__pb2.ProcessBundleDescriptor.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


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,))


 # This class is part of an EXPERIMENTAL API.
class BeamFnData(object):
    """Stable
    """

    @staticmethod
    def Data(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/org.apache.beam.model.fn_execution.v1.BeamFnData/Data',
            beam__fn__api__pb2.Elements.SerializeToString,
            beam__fn__api__pb2.Elements.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class BeamFnStateStub(object):
    """Missing associated documentation comment in .proto file."""

    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."""

    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,))


 # This class is part of an EXPERIMENTAL API.
class BeamFnState(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def State(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/org.apache.beam.model.fn_execution.v1.BeamFnState/State',
            beam__fn__api__pb2.StateRequest.SerializeToString,
            beam__fn__api__pb2.StateResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


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,))


 # This class is part of an EXPERIMENTAL API.
class BeamFnLogging(object):
    """Stable
    """

    @staticmethod
    def Logging(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/org.apache.beam.model.fn_execution.v1.BeamFnLogging/Logging',
            beam__fn__api__pb2.LogEntry.List.SerializeToString,
            beam__fn__api__pb2.LogControl.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class BeamFnExternalWorkerPoolStub(object):
    """Missing associated documentation comment in .proto file."""

    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."""

    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,))


 # This class is part of an EXPERIMENTAL API.
class BeamFnExternalWorkerPool(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def StartWorker(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, '/org.apache.beam.model.fn_execution.v1.BeamFnExternalWorkerPool/StartWorker',
            beam__fn__api__pb2.StartWorkerRequest.SerializeToString,
            beam__fn__api__pb2.StartWorkerResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def StopWorker(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, '/org.apache.beam.model.fn_execution.v1.BeamFnExternalWorkerPool/StopWorker',
            beam__fn__api__pb2.StopWorkerRequest.SerializeToString,
            beam__fn__api__pb2.StopWorkerResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


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."""
        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,))


 # This class is part of an EXPERIMENTAL API.
class BeamFnWorkerStatus(object):
    """API for SDKs to report debug-related statuses to runner during pipeline execution.
    """

    @staticmethod
    def WorkerStatus(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/org.apache.beam.model.fn_execution.v1.BeamFnWorkerStatus/WorkerStatus',
            beam__fn__api__pb2.WorkerStatusResponse.SerializeToString,
            beam__fn__api__pb2.WorkerStatusRequest.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
