Пример #1
0
    def get_srv_keyspace(self, name):
        try:
            request = vtgate_pb2.GetSrvKeyspaceRequest(keyspace=name, )
            response = self.stub.GetSrvKeyspace(request, self.timeout)
            return keyspace.Keyspace(
                name,
                keyrange_constants.srv_keyspace_proto3_to_old(
                    response.srv_keyspace))

        except (face.AbortionError, vtgate_utils.VitessError) as e:
            raise _convert_exception(e, keyspace=name)
Пример #2
0
 def get_srv_keyspace(self, name):
     try:
         response = self._get_client().call('VTGate.GetSrvKeyspace', {
             'Keyspace': name,
         })
         return keyspace.Keyspace(name, response.reply)
     except gorpc.GoRpcError as e:
         raise convert_exception(e, str(self), keyspace=name)
     except:
         logging.exception('gorpc low-level error')
         raise
Пример #3
0
    def keyspace_from_response(self, name, response):
        """Builds a Keyspace object from the response of a GetSrvKeyspace call.

    Args:
      name: keyspace name.
      response: a GetSrvKeyspaceResponse object.

    Returns:
      A keyspace.Keyspace object.
    """
        return keyspace.Keyspace(
            name, self.srv_keyspace_proto3_to_old(response.srv_keyspace))
Пример #4
0
 def get_srv_keyspace(self, name):
     try:
         response = self._get_client().call('VTGate.GetSrvKeyspace', {
             'Keyspace': name,
         })
         vtgate_utils.extract_rpc_error('VTGate.GetSrvKeyspace', response)
         # response.reply is a proto3 encoded in bson RPC.
         # we need to make it back to what keyspace.Keyspace expects
         return keyspace.Keyspace(
             name,
             keyrange_constants.srv_keyspace_proto3_to_old(response.reply))
     except gorpc.GoRpcError as e:
         raise self._convert_exception(e, keyspace=name)
     except:
         logging.exception('gorpc low-level error')
         raise