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

import distlock_pb2 as distlock__pb2


class LockManagerServiceStub(object):
    """A key-value lock service. The intended purpose is to prevent computing
    the same thing twice in distributed pipeline jobs.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.AcquireLock = channel.unary_unary(
                '/distlock.LockManagerService/AcquireLock',
                request_serializer=distlock__pb2.AcquireLockRequest.SerializeToString,
                response_deserializer=distlock__pb2.AcquireLockResponse.FromString,
                )
        self.AcquireMany = channel.unary_unary(
                '/distlock.LockManagerService/AcquireMany',
                request_serializer=distlock__pb2.AcquireManyRequest.SerializeToString,
                response_deserializer=distlock__pb2.AcquireManyResponse.FromString,
                )
        self.ReleaseLock = channel.unary_unary(
                '/distlock.LockManagerService/ReleaseLock',
                request_serializer=distlock__pb2.ReleaseLockRequest.SerializeToString,
                response_deserializer=distlock__pb2.ReleaseLockResponse.FromString,
                )
        self.ProcessBatch = channel.unary_unary(
                '/distlock.LockManagerService/ProcessBatch',
                request_serializer=distlock__pb2.ProcessBatchRequest.SerializeToString,
                response_deserializer=distlock__pb2.ProcessBatchResponse.FromString,
                )
        self.ListLocks = channel.unary_unary(
                '/distlock.LockManagerService/ListLocks',
                request_serializer=distlock__pb2.ListLocksRequest.SerializeToString,
                response_deserializer=distlock__pb2.ListLocksResponse.FromString,
                )
        self.CountLocks = channel.unary_unary(
                '/distlock.LockManagerService/CountLocks',
                request_serializer=distlock__pb2.CountLocksRequest.SerializeToString,
                response_deserializer=distlock__pb2.CountLocksResponse.FromString,
                )
        self.GetCurrentServerTime = channel.unary_unary(
                '/distlock.LockManagerService/GetCurrentServerTime',
                request_serializer=distlock__pb2.GetCurrentServerTimeRequest.SerializeToString,
                response_deserializer=distlock__pb2.GetCurrentServerTimeResponse.FromString,
                )


class LockManagerServiceServicer(object):
    """A key-value lock service. The intended purpose is to prevent computing
    the same thing twice in distributed pipeline jobs.
    """

    def AcquireLock(self, request, context):
        """Attempts to acquire or refresh a single expiring lock.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AcquireMany(self, request, context):
        """Batches AcquireLock but can terminate after acquiring N locks.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReleaseLock(self, request, context):
        """Releases a single lock, removing it from the database. Locks do not have to
        be released and can remain in the database to serve as lookup keys.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ProcessBatch(self, request, context):
        """Processes multiple requests.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListLocks(self, request, context):
        """Lists all locks in the database that match the query.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CountLocks(self, request, context):
        """Counts all locks in the database that match the query.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetCurrentServerTime(self, request, context):
        """Returns unix time. Intended to provide globally consistent timestamps.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_LockManagerServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'AcquireLock': grpc.unary_unary_rpc_method_handler(
                    servicer.AcquireLock,
                    request_deserializer=distlock__pb2.AcquireLockRequest.FromString,
                    response_serializer=distlock__pb2.AcquireLockResponse.SerializeToString,
            ),
            'AcquireMany': grpc.unary_unary_rpc_method_handler(
                    servicer.AcquireMany,
                    request_deserializer=distlock__pb2.AcquireManyRequest.FromString,
                    response_serializer=distlock__pb2.AcquireManyResponse.SerializeToString,
            ),
            'ReleaseLock': grpc.unary_unary_rpc_method_handler(
                    servicer.ReleaseLock,
                    request_deserializer=distlock__pb2.ReleaseLockRequest.FromString,
                    response_serializer=distlock__pb2.ReleaseLockResponse.SerializeToString,
            ),
            'ProcessBatch': grpc.unary_unary_rpc_method_handler(
                    servicer.ProcessBatch,
                    request_deserializer=distlock__pb2.ProcessBatchRequest.FromString,
                    response_serializer=distlock__pb2.ProcessBatchResponse.SerializeToString,
            ),
            'ListLocks': grpc.unary_unary_rpc_method_handler(
                    servicer.ListLocks,
                    request_deserializer=distlock__pb2.ListLocksRequest.FromString,
                    response_serializer=distlock__pb2.ListLocksResponse.SerializeToString,
            ),
            'CountLocks': grpc.unary_unary_rpc_method_handler(
                    servicer.CountLocks,
                    request_deserializer=distlock__pb2.CountLocksRequest.FromString,
                    response_serializer=distlock__pb2.CountLocksResponse.SerializeToString,
            ),
            'GetCurrentServerTime': grpc.unary_unary_rpc_method_handler(
                    servicer.GetCurrentServerTime,
                    request_deserializer=distlock__pb2.GetCurrentServerTimeRequest.FromString,
                    response_serializer=distlock__pb2.GetCurrentServerTimeResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'distlock.LockManagerService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class LockManagerService(object):
    """A key-value lock service. The intended purpose is to prevent computing
    the same thing twice in distributed pipeline jobs.
    """

    @staticmethod
    def AcquireLock(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, '/distlock.LockManagerService/AcquireLock',
            distlock__pb2.AcquireLockRequest.SerializeToString,
            distlock__pb2.AcquireLockResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def AcquireMany(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, '/distlock.LockManagerService/AcquireMany',
            distlock__pb2.AcquireManyRequest.SerializeToString,
            distlock__pb2.AcquireManyResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ReleaseLock(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, '/distlock.LockManagerService/ReleaseLock',
            distlock__pb2.ReleaseLockRequest.SerializeToString,
            distlock__pb2.ReleaseLockResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ProcessBatch(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, '/distlock.LockManagerService/ProcessBatch',
            distlock__pb2.ProcessBatchRequest.SerializeToString,
            distlock__pb2.ProcessBatchResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ListLocks(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, '/distlock.LockManagerService/ListLocks',
            distlock__pb2.ListLocksRequest.SerializeToString,
            distlock__pb2.ListLocksResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def CountLocks(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, '/distlock.LockManagerService/CountLocks',
            distlock__pb2.CountLocksRequest.SerializeToString,
            distlock__pb2.CountLocksResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetCurrentServerTime(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, '/distlock.LockManagerService/GetCurrentServerTime',
            distlock__pb2.GetCurrentServerTimeRequest.SerializeToString,
            distlock__pb2.GetCurrentServerTimeResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
