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

from . import mercurial_repository_pb2 as mercurial__repository__pb2


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

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

        Args:
            channel: A grpc.Channel.
        """
        self.InitConfig = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/InitConfig',
                request_serializer=mercurial__repository__pb2.InitConfigRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.InitConfigResponse.FromString,
                )
        self.GetConfigItem = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/GetConfigItem',
                request_serializer=mercurial__repository__pb2.GetConfigItemRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.GetConfigItemResponse.FromString,
                )
        self.Recover = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/Recover',
                request_serializer=mercurial__repository__pb2.RecoverRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.RecoverResponse.FromString,
                )
        self.Optimize = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/Optimize',
                request_serializer=mercurial__repository__pb2.OptimizeRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.OptimizeResponse.FromString,
                )
        self.ResetCaches = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/ResetCaches',
                request_serializer=mercurial__repository__pb2.ResetCachesRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.ResetCachesResponse.FromString,
                )
        self.GetManagedConfig = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/GetManagedConfig',
                request_serializer=mercurial__repository__pb2.GetManagedConfigRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.GetManagedConfigResponse.FromString,
                )
        self.SetManagedConfig = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/SetManagedConfig',
                request_serializer=mercurial__repository__pb2.SetManagedConfigRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.SetManagedConfigResponse.FromString,
                )
        self.Push = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/Push',
                request_serializer=mercurial__repository__pb2.PushRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.PushResponse.FromString,
                )
        self.Pull = channel.unary_unary(
                '/hgitaly.MercurialRepositoryService/Pull',
                request_serializer=mercurial__repository__pb2.PullRequest.SerializeToString,
                response_deserializer=mercurial__repository__pb2.PullResponse.FromString,
                )


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

    def InitConfig(self, request, context):
        """Will back Rails method `hg_create_repository`,
        currently implemented on `Gitlab::Mercurial::HgGitRepository`
        Together with `RepositoryService.CreateRepository` (see hgitaly!64)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetConfigItem(self, request, context):
        """Will back Rails method `hg_config_item_bool?`  currently
        implemented on `Gitlab::Mercurial::HgGitRepository`
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Recover(self, request, context):
        """/ Recover after abandoned transaction
        /
        / Equivalent of `hg recover`
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Optimize(self, request, context):
        """/ Optimize repository
        /
        / Recompute stuff, switch to more efficient caches and compression, etc.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ResetCaches(self, request, context):
        """/ Reset caches utility
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetManagedConfig(self, request, context):
        """
        Managed configuration methods.


        These are about the part of the repository-local configuration that is
        entirely managed by Heptapod
        (implemented as of this writing with the separate `.hg/hgrc.managed` file)

        Will back Rails methods `get_hgrc` and `get_hg_heptapod_config` currently
        implemented on `Gitlab::Mercurial::HgGitRepository`
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SetManagedConfig(self, request, context):
        """Will back Rails methods `set_hgrc` currently implemented on
        `Gitlab::Mercurial::HgGitRepository` (but will be more restrictive,
        handling a closed list of sections and items, which is currently
        implemented by the upper layers of the Rails application).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Push(self, request, context):
        """/ Will back Rails method `hg_push` (has never been implemented with a
        / subprocess)
        /
        / Main use-case is push mirroring, as in upstream's
        / `Remote.UpdateRemoteMirror`. A difference with the latter, that we can
        / accept for now, is the streaming request of `UpdateRemoteMirror`,
        / which is meant to pass very long lists of branch patterns in
        / `only_branches_matching`.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Pull(self, request, context):
        """/ Pull from some remote repo.
        /
        / Not very different from RepositoryService.FetchRemote, but we'll avoid
        / a few Git-specific concepts.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MercurialRepositoryServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'InitConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.InitConfig,
                    request_deserializer=mercurial__repository__pb2.InitConfigRequest.FromString,
                    response_serializer=mercurial__repository__pb2.InitConfigResponse.SerializeToString,
            ),
            'GetConfigItem': grpc.unary_unary_rpc_method_handler(
                    servicer.GetConfigItem,
                    request_deserializer=mercurial__repository__pb2.GetConfigItemRequest.FromString,
                    response_serializer=mercurial__repository__pb2.GetConfigItemResponse.SerializeToString,
            ),
            'Recover': grpc.unary_unary_rpc_method_handler(
                    servicer.Recover,
                    request_deserializer=mercurial__repository__pb2.RecoverRequest.FromString,
                    response_serializer=mercurial__repository__pb2.RecoverResponse.SerializeToString,
            ),
            'Optimize': grpc.unary_unary_rpc_method_handler(
                    servicer.Optimize,
                    request_deserializer=mercurial__repository__pb2.OptimizeRequest.FromString,
                    response_serializer=mercurial__repository__pb2.OptimizeResponse.SerializeToString,
            ),
            'ResetCaches': grpc.unary_unary_rpc_method_handler(
                    servicer.ResetCaches,
                    request_deserializer=mercurial__repository__pb2.ResetCachesRequest.FromString,
                    response_serializer=mercurial__repository__pb2.ResetCachesResponse.SerializeToString,
            ),
            'GetManagedConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.GetManagedConfig,
                    request_deserializer=mercurial__repository__pb2.GetManagedConfigRequest.FromString,
                    response_serializer=mercurial__repository__pb2.GetManagedConfigResponse.SerializeToString,
            ),
            'SetManagedConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.SetManagedConfig,
                    request_deserializer=mercurial__repository__pb2.SetManagedConfigRequest.FromString,
                    response_serializer=mercurial__repository__pb2.SetManagedConfigResponse.SerializeToString,
            ),
            'Push': grpc.unary_unary_rpc_method_handler(
                    servicer.Push,
                    request_deserializer=mercurial__repository__pb2.PushRequest.FromString,
                    response_serializer=mercurial__repository__pb2.PushResponse.SerializeToString,
            ),
            'Pull': grpc.unary_unary_rpc_method_handler(
                    servicer.Pull,
                    request_deserializer=mercurial__repository__pb2.PullRequest.FromString,
                    response_serializer=mercurial__repository__pb2.PullResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'hgitaly.MercurialRepositoryService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


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

    @staticmethod
    def InitConfig(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, '/hgitaly.MercurialRepositoryService/InitConfig',
            mercurial__repository__pb2.InitConfigRequest.SerializeToString,
            mercurial__repository__pb2.InitConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetConfigItem(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, '/hgitaly.MercurialRepositoryService/GetConfigItem',
            mercurial__repository__pb2.GetConfigItemRequest.SerializeToString,
            mercurial__repository__pb2.GetConfigItemResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Recover(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, '/hgitaly.MercurialRepositoryService/Recover',
            mercurial__repository__pb2.RecoverRequest.SerializeToString,
            mercurial__repository__pb2.RecoverResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Optimize(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, '/hgitaly.MercurialRepositoryService/Optimize',
            mercurial__repository__pb2.OptimizeRequest.SerializeToString,
            mercurial__repository__pb2.OptimizeResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ResetCaches(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, '/hgitaly.MercurialRepositoryService/ResetCaches',
            mercurial__repository__pb2.ResetCachesRequest.SerializeToString,
            mercurial__repository__pb2.ResetCachesResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetManagedConfig(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, '/hgitaly.MercurialRepositoryService/GetManagedConfig',
            mercurial__repository__pb2.GetManagedConfigRequest.SerializeToString,
            mercurial__repository__pb2.GetManagedConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SetManagedConfig(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, '/hgitaly.MercurialRepositoryService/SetManagedConfig',
            mercurial__repository__pb2.SetManagedConfigRequest.SerializeToString,
            mercurial__repository__pb2.SetManagedConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Push(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, '/hgitaly.MercurialRepositoryService/Push',
            mercurial__repository__pb2.PushRequest.SerializeToString,
            mercurial__repository__pb2.PushResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Pull(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, '/hgitaly.MercurialRepositoryService/Pull',
            mercurial__repository__pb2.PullRequest.SerializeToString,
            mercurial__repository__pb2.PullResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
