Пример #1
0
 def __delete_ns__(self, namespace):
     del_ns_req = storage_pb2.DeleteNamespaceRequest(
         name=namespace
     )
     del_ns_resp = self.__root_range_service__.DeleteNamespace(
         request=del_ns_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     from_root_range_rpc_response(del_ns_resp)
Пример #2
0
 def __delete_stream__(self, stream_name):
     del_stream_req = storage_pb2.DeleteStreamRequest(
         ns_name=self.__namespace__,
         name=stream_name
     )
     del_stream_resp = self.__root_range_service__.DeleteStream(
         request=del_stream_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     from_root_range_rpc_response(del_stream_resp)
Пример #3
0
 def __create_ns__(self, namespace, namespace_config):
     create_ns_req = storage_pb2.CreateNamespaceRequest(
         name=namespace, ns_conf=namespace_config)
     create_ns_resp = self.__root_range_service__.CreateNamespace(
         request=create_ns_req, metadata=__ROOT_RANGE_METADATA__)
     create_ns_resp = from_root_range_rpc_response(create_ns_resp)
     return create_ns_resp.ns_props
Пример #4
0
 def __get_stream__(self, stream_name):
     get_stream_req = storage_pb2.GetStreamRequest(
         stream_name=stream_pb2.StreamName(
             namespace_name=self.__namespace__, stream_name=stream_name))
     get_stream_resp = self.__root_range_service__.GetStream(
         request=get_stream_req, metadata=__ROOT_RANGE_METADATA__)
     get_stream_resp = from_root_range_rpc_response(get_stream_resp)
     return get_stream_resp.stream_props
Пример #5
0
 def __get_ns__(self, namespace):
     get_ns_req = storage_pb2.GetNamespaceRequest(
         name=namespace
     )
     get_ns_resp = self.__root_range_service__.GetNamespace(
         request=get_ns_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     get_ns_resp = from_root_range_rpc_response(get_ns_resp)
     return get_ns_resp.ns_props
Пример #6
0
 def __create_ns__(self, namespace, namespace_config):
     create_ns_req = storage_pb2.CreateNamespaceRequest(
         name=namespace,
         ns_conf=namespace_config
     )
     create_ns_resp = self.__root_range_service__.CreateNamespace(
         request=create_ns_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     create_ns_resp = from_root_range_rpc_response(create_ns_resp)
     return create_ns_resp.ns_props
Пример #7
0
 def __create_stream__(self, stream_name, stream_config):
     create_stream_req = storage_pb2.CreateStreamRequest(
         ns_name=self.__namespace__,
         name=stream_name,
         stream_conf=stream_config
     )
     create_stream_resp = self.__root_range_service__.CreateStream(
         request=create_stream_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     create_stream_resp = from_root_range_rpc_response(create_stream_resp)
     return create_stream_resp.stream_props
Пример #8
0
 def __get_stream__(self, stream_name):
     get_stream_req = storage_pb2.GetStreamRequest(
         stream_name=stream_pb2.StreamName(
             namespace_name=self.__namespace__,
             stream_name=stream_name
         )
     )
     get_stream_resp = self.__root_range_service__.GetStream(
         request=get_stream_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     get_stream_resp = from_root_range_rpc_response(get_stream_resp)
     return get_stream_resp.stream_props
Пример #9
0
 def __create_ns__(self, namespace, namespace_config):
     create_ns_req = storage_pb2.CreateNamespaceRequest(
         name=namespace, ns_conf=namespace_config)
     create_ns_resp = self.__root_range_service__.CreateNamespace(
         request=create_ns_req, metadata=__ROOT_RANGE_METADATA__)
     try:
         create_ns_resp = from_root_range_rpc_response(create_ns_resp)
         return create_ns_resp.ns_props
     except InternalServerError as ise:
         # currently if a namespace exists, it also throws
         # internal server error.
         try:
             self.get(namespace=namespace)
             raise NamespaceExistsError("namespace '%s' already exists" %
                                        namespace)
         except NamespaceNotFoundError:
             raise ise
Пример #10
0
 def __create_ns__(self, namespace, namespace_config):
     create_ns_req = storage_pb2.CreateNamespaceRequest(
         name=namespace,
         ns_conf=namespace_config
     )
     create_ns_resp = self.__root_range_service__.CreateNamespace(
         request=create_ns_req,
         metadata=__ROOT_RANGE_METADATA__
     )
     try:
         create_ns_resp = from_root_range_rpc_response(create_ns_resp)
         return create_ns_resp.ns_props
     except InternalServerError as ise:
         # currently if a namespace exists, it also throws
         # internal server error.
         try:
             self.get(namespace=namespace)
             raise NamespaceExistsError("namespace '%s' already exists" % namespace)
         except NamespaceNotFoundError:
             raise ise
Пример #11
0
 def __create_stream__(self, stream_name, stream_config):
     create_stream_req = storage_pb2.CreateStreamRequest(
         ns_name=self.__namespace__,
         name=stream_name,
         stream_conf=stream_config)
     create_stream_resp = self.__root_range_service__.CreateStream(
         request=create_stream_req, metadata=__ROOT_RANGE_METADATA__)
     try:
         create_stream_resp = from_root_range_rpc_response(
             create_stream_resp)
         return create_stream_resp.stream_props
     except InternalServerError as ise:
         # currently if a stream exists, it also throws
         # internal server error
         try:
             self.get(stream_name=stream_name)
             raise StreamExistsError(
                 "stream '%s' already exists at namespace '%s'" %
                 (stream_name, self.__namespace__))
         except StreamNotFoundError:
             raise ise
Пример #12
0
 def __delete_ns__(self, namespace):
     del_ns_req = storage_pb2.DeleteNamespaceRequest(name=namespace)
     del_ns_resp = self.__root_range_service__.DeleteNamespace(
         request=del_ns_req, metadata=__ROOT_RANGE_METADATA__)
     from_root_range_rpc_response(del_ns_resp)
Пример #13
0
 def __get_ns__(self, namespace):
     get_ns_req = storage_pb2.GetNamespaceRequest(name=namespace)
     get_ns_resp = self.__root_range_service__.GetNamespace(
         request=get_ns_req, metadata=__ROOT_RANGE_METADATA__)
     get_ns_resp = from_root_range_rpc_response(get_ns_resp)
     return get_ns_resp.ns_props