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

from fabric_protos_python.peer import chaincode_shim_pb2 as peer_dot_chaincode__shim__pb2


class ChaincodeSupportStub(object):
    """Interface that provides support to chaincode execution. ChaincodeContext
    provides the context necessary for the server to respond appropriately.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Register = channel.stream_stream(
                '/protos.ChaincodeSupport/Register',
                request_serializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString,
                response_deserializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString,
                )


class ChaincodeSupportServicer(object):
    """Interface that provides support to chaincode execution. ChaincodeContext
    provides the context necessary for the server to respond appropriately.
    """

    def Register(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_ChaincodeSupportServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Register': grpc.stream_stream_rpc_method_handler(
                    servicer.Register,
                    request_deserializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString,
                    response_serializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'protos.ChaincodeSupport', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class ChaincodeSupport(object):
    """Interface that provides support to chaincode execution. ChaincodeContext
    provides the context necessary for the server to respond appropriately.
    """

    @staticmethod
    def Register(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, '/protos.ChaincodeSupport/Register',
            peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString,
            peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class ChaincodeStub(object):
    """Chaincode as a server - peer establishes a connection to the chaincode as a client
    Currently only supports a stream connection.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Connect = channel.stream_stream(
                '/protos.Chaincode/Connect',
                request_serializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString,
                response_deserializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString,
                )


class ChaincodeServicer(object):
    """Chaincode as a server - peer establishes a connection to the chaincode as a client
    Currently only supports a stream connection.
    """

    def Connect(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_ChaincodeServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Connect': grpc.stream_stream_rpc_method_handler(
                    servicer.Connect,
                    request_deserializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString,
                    response_serializer=peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'protos.Chaincode', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Chaincode(object):
    """Chaincode as a server - peer establishes a connection to the chaincode as a client
    Currently only supports a stream connection.
    """

    @staticmethod
    def Connect(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, '/protos.Chaincode/Connect',
            peer_dot_chaincode__shim__pb2.ChaincodeMessage.SerializeToString,
            peer_dot_chaincode__shim__pb2.ChaincodeMessage.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
