# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: Datastore.proto

import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()


import Types_pb2 as Types__pb2


DESCRIPTOR = _descriptor.FileDescriptor(
  name='Datastore.proto',
  package='protocol',
  syntax='proto3',
  serialized_pb=_b('\n\x0f\x44\x61tastore.proto\x12\x08protocol\x1a\x0bTypes.proto\"\x1a\n\nDataObject\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x32\x88\x01\n\x10\x44\x61tastoreService\x12\x39\n\x03put\x12\x14.protocol.DataObject\x1a\x1c.protocol.MultihashReference\x12\x39\n\x03get\x12\x1c.protocol.MultihashReference\x1a\x14.protocol.DataObjectB\"\n io.mediachain.protocol.datastoreb\x06proto3')
  ,
  dependencies=[Types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)




_DATAOBJECT = _descriptor.Descriptor(
  name='DataObject',
  full_name='protocol.DataObject',
  filename=None,
  file=DESCRIPTOR,
  containing_type=None,
  fields=[
    _descriptor.FieldDescriptor(
      name='data', full_name='protocol.DataObject.data', index=0,
      number=1, type=12, cpp_type=9, label=1,
      has_default_value=False, default_value=_b(""),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
  ],
  extensions=[
  ],
  nested_types=[],
  enum_types=[
  ],
  options=None,
  is_extendable=False,
  syntax='proto3',
  extension_ranges=[],
  oneofs=[
  ],
  serialized_start=42,
  serialized_end=68,
)

DESCRIPTOR.message_types_by_name['DataObject'] = _DATAOBJECT

DataObject = _reflection.GeneratedProtocolMessageType('DataObject', (_message.Message,), dict(
  DESCRIPTOR = _DATAOBJECT,
  __module__ = 'Datastore_pb2'
  # @@protoc_insertion_point(class_scope:protocol.DataObject)
  ))
_sym_db.RegisterMessage(DataObject)


DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n io.mediachain.protocol.datastore'))
import grpc
from grpc.beta import implementations as beta_implementations
from grpc.beta import interfaces as beta_interfaces
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities


class DatastoreServiceStub(object):

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

    Args:
      channel: A grpc.Channel.
    """
    self.put = channel.unary_unary(
        '/protocol.DatastoreService/put',
        request_serializer=DataObject.SerializeToString,
        response_deserializer=Types__pb2.MultihashReference.FromString,
        )
    self.get = channel.unary_unary(
        '/protocol.DatastoreService/get',
        request_serializer=Types__pb2.MultihashReference.SerializeToString,
        response_deserializer=DataObject.FromString,
        )


class DatastoreServiceServicer(object):

  def put(self, request, context):
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def get(self, request, context):
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_DatastoreServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'put': grpc.unary_unary_rpc_method_handler(
          servicer.put,
          request_deserializer=DataObject.FromString,
          response_serializer=Types__pb2.MultihashReference.SerializeToString,
      ),
      'get': grpc.unary_unary_rpc_method_handler(
          servicer.get,
          request_deserializer=Types__pb2.MultihashReference.FromString,
          response_serializer=DataObject.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'protocol.DatastoreService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


class BetaDatastoreServiceServicer(object):
  def put(self, request, context):
    context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
  def get(self, request, context):
    context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)


class BetaDatastoreServiceStub(object):
  def put(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
    raise NotImplementedError()
  put.future = None
  def get(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
    raise NotImplementedError()
  get.future = None


def beta_create_DatastoreService_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
  request_deserializers = {
    ('protocol.DatastoreService', 'get'): Types__pb2.MultihashReference.FromString,
    ('protocol.DatastoreService', 'put'): DataObject.FromString,
  }
  response_serializers = {
    ('protocol.DatastoreService', 'get'): DataObject.SerializeToString,
    ('protocol.DatastoreService', 'put'): Types__pb2.MultihashReference.SerializeToString,
  }
  method_implementations = {
    ('protocol.DatastoreService', 'get'): face_utilities.unary_unary_inline(servicer.get),
    ('protocol.DatastoreService', 'put'): face_utilities.unary_unary_inline(servicer.put),
  }
  server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout)
  return beta_implementations.server(method_implementations, options=server_options)


def beta_create_DatastoreService_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
  request_serializers = {
    ('protocol.DatastoreService', 'get'): Types__pb2.MultihashReference.SerializeToString,
    ('protocol.DatastoreService', 'put'): DataObject.SerializeToString,
  }
  response_deserializers = {
    ('protocol.DatastoreService', 'get'): DataObject.FromString,
    ('protocol.DatastoreService', 'put'): Types__pb2.MultihashReference.FromString,
  }
  cardinalities = {
    'get': cardinality.Cardinality.UNARY_UNARY,
    'put': cardinality.Cardinality.UNARY_UNARY,
  }
  stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size)
  return beta_implementations.dynamic_stub(channel, 'protocol.DatastoreService', cardinalities, options=stub_options)
# @@protoc_insertion_point(module_scope)
