# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from kikimr.public.api.protos import ydb_operation_pb2 as kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2


class OperationServiceStub(object):
  """All rpc calls to YDB are allowed to be asynchronous. Response message
  of an rpc call contains Operation structure and OperationService
  is used for polling operation completion.

  Operation has a field 'ready' to notify client if operation has been
  completed or not. If result is ready a client has to handle 'result' field,
  otherwise it is expected that client continues polling result via
  GetOperation rpc of OperationService. Polling is made via unique
  operation id provided in 'id' field of Operation.

  Note: Currently some operations have synchronous implementation and their result
  is available when response is obtained. But a client must not make any
  assumptions about synchronous or asynchronous nature of any operation and
  be ready to poll operation status.

  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.GetOperation = channel.unary_unary(
        '/Ydb.Operation.V1.OperationService/GetOperation',
        request_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.GetOperationRequest.SerializeToString,
        response_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.GetOperationResponse.FromString,
        )
    self.CancelOperation = channel.unary_unary(
        '/Ydb.Operation.V1.OperationService/CancelOperation',
        request_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.CancelOperationRequest.SerializeToString,
        response_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.CancelOperationResponse.FromString,
        )
    self.ForgetOperation = channel.unary_unary(
        '/Ydb.Operation.V1.OperationService/ForgetOperation',
        request_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ForgetOperationRequest.SerializeToString,
        response_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ForgetOperationResponse.FromString,
        )
    self.ListOperations = channel.unary_unary(
        '/Ydb.Operation.V1.OperationService/ListOperations',
        request_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ListOperationsRequest.SerializeToString,
        response_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ListOperationsResponse.FromString,
        )


class OperationServiceServicer(object):
  """All rpc calls to YDB are allowed to be asynchronous. Response message
  of an rpc call contains Operation structure and OperationService
  is used for polling operation completion.

  Operation has a field 'ready' to notify client if operation has been
  completed or not. If result is ready a client has to handle 'result' field,
  otherwise it is expected that client continues polling result via
  GetOperation rpc of OperationService. Polling is made via unique
  operation id provided in 'id' field of Operation.

  Note: Currently some operations have synchronous implementation and their result
  is available when response is obtained. But a client must not make any
  assumptions about synchronous or asynchronous nature of any operation and
  be ready to poll operation status.

  """

  def GetOperation(self, request, context):
    """Check status for a given operation.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def CancelOperation(self, request, context):
    """Starts cancellation of a long-running operation,
    Clients can use GetOperation to check whether the cancellation succeeded
    or whether the operation completed despite cancellation.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def ForgetOperation(self, request, context):
    """Forgets long-running operation. It does not cancel the operation and returns
    an error if operation was not completed.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def ListOperations(self, request, context):
    """Lists operations that match the specified filter in the request.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_OperationServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'GetOperation': grpc.unary_unary_rpc_method_handler(
          servicer.GetOperation,
          request_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.GetOperationRequest.FromString,
          response_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.GetOperationResponse.SerializeToString,
      ),
      'CancelOperation': grpc.unary_unary_rpc_method_handler(
          servicer.CancelOperation,
          request_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.CancelOperationRequest.FromString,
          response_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.CancelOperationResponse.SerializeToString,
      ),
      'ForgetOperation': grpc.unary_unary_rpc_method_handler(
          servicer.ForgetOperation,
          request_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ForgetOperationRequest.FromString,
          response_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ForgetOperationResponse.SerializeToString,
      ),
      'ListOperations': grpc.unary_unary_rpc_method_handler(
          servicer.ListOperations,
          request_deserializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ListOperationsRequest.FromString,
          response_serializer=kikimr_dot_public_dot_api_dot_protos_dot_ydb__operation__pb2.ListOperationsResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'Ydb.Operation.V1.OperationService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
