Java Code Examples for org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil#toNamespaceDescriptor()

The following examples show how to use org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil#toNamespaceDescriptor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableNamespaceManager.java    From hbase with Apache License 2.0 6 votes vote down vote up
private void loadNamespaceIntoCache() throws IOException {
  try (Table table = masterServices.getConnection().getTable(TableName.META_TABLE_NAME);
    ResultScanner scanner = table.getScanner(HConstants.NAMESPACE_FAMILY)) {
    for (Result result;;) {
      result = scanner.next();
      if (result == null) {
        break;
      }
      Cell cell = result.getColumnLatestCell(HConstants.NAMESPACE_FAMILY,
        HConstants.NAMESPACE_COL_DESC_QUALIFIER);
      NamespaceDescriptor ns = ProtobufUtil
        .toNamespaceDescriptor(HBaseProtos.NamespaceDescriptor.parseFrom(CodedInputStream
          .newInstance(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())));
      cache.put(ns.getName(), ns);
    }
  }
}
 
Example 2
Source File: DeleteNamespaceProcedure.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException {
  super.deserializeStateData(serializer);

  MasterProcedureProtos.DeleteNamespaceStateData deleteNamespaceMsg =
    serializer.deserialize(MasterProcedureProtos.DeleteNamespaceStateData.class);
  namespaceName = deleteNamespaceMsg.getNamespaceName();
  if (deleteNamespaceMsg.hasNamespaceDescriptor()) {
    nsDescriptor =
      ProtobufUtil.toNamespaceDescriptor(deleteNamespaceMsg.getNamespaceDescriptor());
  }
}
 
Example 3
Source File: ModifyNamespaceProcedure.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException {
  super.deserializeStateData(serializer);

  MasterProcedureProtos.ModifyNamespaceStateData modifyNamespaceMsg =
    serializer.deserialize(MasterProcedureProtos.ModifyNamespaceStateData.class);
  newNsDescriptor =
    ProtobufUtil.toNamespaceDescriptor(modifyNamespaceMsg.getNamespaceDescriptor());
  if (modifyNamespaceMsg.hasUnmodifiedNamespaceDescriptor()) {
    oldNsDescriptor =
      ProtobufUtil.toNamespaceDescriptor(modifyNamespaceMsg.getUnmodifiedNamespaceDescriptor());
  }
}
 
Example 4
Source File: CreateNamespaceProcedure.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException {
  super.deserializeStateData(serializer);

  MasterProcedureProtos.CreateNamespaceStateData createNamespaceMsg =
    serializer.deserialize(MasterProcedureProtos.CreateNamespaceStateData.class);
  nsDescriptor = ProtobufUtil.toNamespaceDescriptor(createNamespaceMsg.getNamespaceDescriptor());
}