org.apache.hadoop.hbase.TableName.getName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(283)

本文整理了Java中org.apache.hadoop.hbase.TableName.getName()方法的一些代码示例,展示了TableName.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableName.getName()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.TableName
类名称:TableName
方法名:getName

TableName.getName介绍

[英]Ideally, getNameAsString should contain namespace within it, but if the namespace is default, it just returns the name. This method takes care of this corner case.
[中]理想情况下,getNameAsString应该包含名称空间,但如果名称空间是默认名称空间,则只返回名称。这种方法可以解决这个问题。

代码示例

代码示例来源:origin: apache/hbase

/**
 * Returns the table name converted to a byte array.
 * @see #getTable()
 * @return The table name.
 */
public byte [] getTableName() {
 return tableName.getName();
}

代码示例来源:origin: apache/hbase

private TableName validateNames(TableName expected, Names names) {
 assertEquals(expected.getNameAsString(), names.nn);
 assertArrayEquals(expected.getName(), names.nnb);
 assertEquals(expected.getQualifierAsString(), names.tn);
 assertArrayEquals(expected.getQualifier(), names.tnb);
 assertEquals(expected.getNamespaceAsString(), names.ns);
 assertArrayEquals(expected.getNamespace(), names.nsb);
 return expected;
}

代码示例来源:origin: apache/hbase

private void setHashCode() {
 int result = Arrays.hashCode(this.regionName);
 result = (int) (result ^ this.regionId);
 result ^= Arrays.hashCode(this.startKey);
 result ^= Arrays.hashCode(this.endKey);
 result ^= Boolean.valueOf(this.offLine).hashCode();
 result ^= Arrays.hashCode(this.tableName.getName());
 result ^= this.replicaId;
 this.hashCode = result;
}

代码示例来源:origin: apache/hbase

/**
 * Gets the table name used in the table lock.
 * The table lock name is a dummy one, it's not a table name. It's tableName + ".mobLock".
 * @param tn The table name.
 * @return The table name used in table lock.
 */
public static TableName getTableLockName(TableName tn) {
 byte[] tableName = tn.getName();
 return TableName.valueOf(Bytes.add(tableName, MobConstants.MOB_TABLE_LOCK_SUFFIX));
}

代码示例来源:origin: apache/hbase

/**
 * Returns the currently granted permissions for a given table as the specified user plus
 * associated permissions.
 */
static List<UserPermission> getUserTablePermissions(Configuration conf, TableName tableName,
  byte[] cf, byte[] cq, String userName, boolean hasFilterUser) throws IOException {
 return getUserPermissions(conf, tableName == null ? null : tableName.getName(), cf, cq,
  userName, hasFilterUser);
}

代码示例来源:origin: apache/hbase

/**
 * @return Name of this table and then a map of all of the column family
 * descriptors (with only the non-default column family attributes)
 */
@Override
public String toStringCustomizedValues() {
 StringBuilder s = new StringBuilder();
 s.append('\'').append(Bytes.toString(name.getName())).append('\'');
 s.append(getValues(false));
 families.values().forEach(hcd -> s.append(", ").append(hcd.toStringCustomizedValues()));
 return s.toString();
}

代码示例来源:origin: apache/hbase

private static int generateHashCode(final TableName tableName, final byte[] startKey,
  final byte[] endKey, final long regionId,
  final int replicaId, boolean offLine, byte[] regionName) {
 int result = Arrays.hashCode(regionName);
 result = (int) (result ^ regionId);
 result ^= Arrays.hashCode(checkStartKey(startKey));
 result ^= Arrays.hashCode(checkEndKey(endKey));
 result ^= Boolean.valueOf(offLine).hashCode();
 result ^= Arrays.hashCode(tableName.getName());
 result ^= replicaId;
 return result;
}

代码示例来源:origin: apache/hbase

ArrayList<RegionStateNode> getTableRegionStateNodes(final TableName tableName) {
 final ArrayList<RegionStateNode> regions = new ArrayList<RegionStateNode>();
 for (RegionStateNode node: regionsMap.tailMap(tableName.getName()).values()) {
  if (!node.getTable().equals(tableName)) break;
  regions.add(node);
 }
 return regions;
}

代码示例来源:origin: apache/hbase

static Put createPutForBulkLoadedFile(TableName tn, byte[] fam, String p, String backupId,
  long ts, int idx) {
 Put put = new Put(rowkey(BULK_LOAD_PREFIX, backupId + BLK_LD_DELIM + ts + BLK_LD_DELIM + idx));
 put.addColumn(BackupSystemTable.META_FAMILY, TBL_COL, tn.getName());
 put.addColumn(BackupSystemTable.META_FAMILY, FAM_COL, fam);
 put.addColumn(BackupSystemTable.META_FAMILY, PATH_COL, p.getBytes());
 return put;
}

代码示例来源:origin: apache/hbase

ArrayList<RegionInfo> getTableRegionsInfo(final TableName tableName) {
 final ArrayList<RegionInfo> regions = new ArrayList<RegionInfo>();
 for (RegionStateNode node: regionsMap.tailMap(tableName.getName()).values()) {
  if (!node.getTable().equals(tableName)) break;
  regions.add(node.getRegionInfo());
 }
 return regions;
}

代码示例来源:origin: apache/hbase

/**
 * Wait until all regions in a table have been assigned.  Waits default timeout before giving up
 * (30 seconds).
 * @param table Table to wait on.
 * @throws InterruptedException
 * @throws IOException
 */
public void waitTableAvailable(TableName table)
  throws InterruptedException, IOException {
 waitTableAvailable(table.getName(), 30000);
}

代码示例来源:origin: apache/hbase

ArrayList<RegionState> getTableRegionStates(final TableName tableName) {
 final ArrayList<RegionState> regions = new ArrayList<RegionState>();
 for (RegionStateNode node: regionsMap.tailMap(tableName.getName()).values()) {
  if (!node.getTable().equals(tableName)) break;
  regions.add(node.toRegionState());
 }
 return regions;
}

代码示例来源:origin: apache/hbase

@Override
 public boolean visit(Result r) throws IOException {
  if (!Arrays.equals(r.getRow(), table.getName()))
   return false;
  TableState state = MetaTableAccessor.getTableState(r);
  if (state != null)
   lastTableState.set(state);
  return true;
 }
};

代码示例来源:origin: apache/hbase

public void write(DataOutput out) throws IOException {
 Bytes.writeByteArray(out, this.m_tableName.getName());
 Bytes.writeByteArray(out, this.m_startRow);
 Bytes.writeByteArray(out, this.m_endRow);
 Bytes.writeByteArray(out, Bytes.toBytes(this.m_regionLocation));
}

代码示例来源:origin: apache/hbase

/**
 * Construct PUT for given state
 * @param state new state
 */
public static Put makePutFromTableState(TableState state, long ts) {
 Put put = new Put(state.getTableName().getName(), ts);
 put.addColumn(getTableFamily(), getTableStateColumn(), state.convert().toByteArray());
 return put;
}

代码示例来源:origin: apache/hbase

private Table createTable()
throws IOException, InterruptedException {
 final TableName tableName = TableName.valueOf(name.getMethodName());
 Table table = TEST_UTIL.createTable(tableName, FAMILY);
 TEST_UTIL.waitTableAvailable(tableName.getName(), 5000);
 return table;
}

代码示例来源:origin: apache/hbase

private void loadData(TableName table, int numRows) throws IOException {
 Connection conn = util.getConnection();
 // #0- insert some data to a table
 Table t1 = conn.getTable(table);
 util.loadRandomRows(t1, new byte[]{'f'}, 100, numRows);
 // flush table
 conn.getAdmin().flush(TableName.valueOf(table.getName()));
}

代码示例来源:origin: apache/hbase

@Override
 public Object run() throws Exception {
  try (Connection conn = ConnectionFactory.createConnection(conf);
    Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {
   BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());
   AccessControlService.BlockingInterface protocol =
     AccessControlService.newBlockingStub(service);
   AccessControlUtil.getUserPermissions(null, protocol, Bytes.toBytes(namespace1), "dummy");
  }
  return null;
 }
};

代码示例来源:origin: apache/hbase

@Override
 public Object run() throws Exception {
  try(Connection conn = ConnectionFactory.createConnection(conf);
    Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)){
   BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());
   AccessControlService.BlockingInterface protocol =
     AccessControlService.newBlockingStub(service);
   AccessControlUtil.getUserPermissions(null, protocol, TEST_TABLE);
  }
  return null;
 }
};

代码示例来源:origin: apache/hbase

@Override
 public Object run() throws Exception {
  try (Connection conn = ConnectionFactory.createConnection(conf);
    Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {
   BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());
   AccessControlService.BlockingInterface protocol =
     AccessControlService.newBlockingStub(service);
   AccessControlUtil.getUserPermissions(null, protocol, "dummy");
  }
  return null;
 }
};

相关文章