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

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

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

TableName.equals介绍

暂无

代码示例

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

  1. /**
  2. * Drop this instance's tablename byte array and instead
  3. * hold a reference to the provided tablename. This is not
  4. * meant to be a general purpose setter - it's only used
  5. * to collapse references to conserve memory.
  6. */
  7. void internTableName(TableName tablename) {
  8. // We should not use this as a setter - only to swap
  9. // in a new reference to the same table name.
  10. assert tablename.equals(this.tablename);
  11. this.tablename = tablename;
  12. }

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

  1. @Override
  2. public boolean equals(Object o) {
  3. if (!(o instanceof CacheKey)) {
  4. return false;
  5. }
  6. CacheKey other = (CacheKey) o;
  7. // TableName should be the only thing differing..
  8. return tn.equals(other.tn) && conn.equals(other.conn) && conf.equals(other.conf)
  9. && fs.equals(other.fs);
  10. }

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

  1. @Override
  2. public boolean apply(Entry<RegionInfo,Long> input) {
  3. return table.equals(input.getKey().getTable());
  4. }
  5. });

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

  1. /** @return true if this region is a meta region */
  2. @Override
  3. public boolean isMetaRegion() {
  4. return tableName.equals(FIRST_META_REGIONINFO.getTable());
  5. }

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

  1. @Override
  2. public boolean equals(Object o) {
  3. if (o == null || !(o instanceof TableSplit)) {
  4. return false;
  5. }
  6. return tableName.equals(((TableSplit)o).tableName) &&
  7. Bytes.equals(startRow, ((TableSplit)o).startRow) &&
  8. Bytes.equals(endRow, ((TableSplit)o).endRow) &&
  9. regionLocation.equals(((TableSplit)o).regionLocation);
  10. }

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

  1. @Override
  2. public CompletableFuture<List<RegionInfo>> getRegions(TableName tableName) {
  3. if (tableName.equals(META_TABLE_NAME)) {
  4. return connection.getLocator().getRegionLocation(tableName, null, null, operationTimeoutNs)
  5. .thenApply(loc -> Collections.singletonList(loc.getRegion()));
  6. } else {
  7. return AsyncMetaTableAccessor.getTableHRegionLocations(metaTable, Optional.of(tableName))
  8. .thenApply(
  9. locs -> locs.stream().map(loc -> loc.getRegion()).collect(Collectors.toList()));
  10. }
  11. }

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

  1. /**
  2. * Returns {@code true} if the given region is part of the {@code _acl_}
  3. * metadata table.
  4. */
  5. static boolean isAclRegion(Region region) {
  6. return ACL_TABLE_NAME.equals(region.getTableDescriptor().getTableName());
  7. }

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

  1. ArrayList<RegionStateNode> getTableRegionStateNodes(final TableName tableName) {
  2. final ArrayList<RegionStateNode> regions = new ArrayList<RegionStateNode>();
  3. for (RegionStateNode node: regionsMap.tailMap(tableName.getName()).values()) {
  4. if (!node.getTable().equals(tableName)) break;
  5. regions.add(node);
  6. }
  7. return regions;
  8. }

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

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

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

  1. private int countRegionsForTable(TableName tn, Map<RegionInfo,Long> regionSizes) {
  2. int size = 0;
  3. for (RegionInfo regionInfo : regionSizes.keySet()) {
  4. if (tn.equals(regionInfo.getTable())) {
  5. size++;
  6. }
  7. }
  8. return size;
  9. }

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

  1. @Override
  2. public Optional<Pair<String, String>> getPeerIdAndRemoteWALDir(TableName table) {
  3. if (table != null && table.equals(TABLE)) {
  4. return Optional.of(Pair.newPair(PEER_ID, REMOTE_WAL_DIR));
  5. } else {
  6. return Optional.empty();
  7. }
  8. }

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

  1. private int getRegionReportsForTable(Map<RegionInfo,Long> reports, TableName tn) {
  2. int numReports = 0;
  3. for (Entry<RegionInfo,Long> entry : reports.entrySet()) {
  4. if (tn.equals(entry.getKey().getTable())) {
  5. numReports++;
  6. }
  7. }
  8. return numReports;
  9. }
  10. }

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

  1. private List<HRegion> getRegionInfo(HRegionServer rs) {
  2. return rs.getRegions().stream()
  3. .filter(v -> v.getTableDescriptor().getTableName().equals(tableName))
  4. .collect(Collectors.toList());
  5. }
  6. }

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

  1. @Override
  2. public boolean visit(Result r) throws IOException {
  3. if (MetaTableAccessor.getRegionInfo(r).getTable().equals(table)) count.incrementAndGet();
  4. return true;
  5. }
  6. };

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

  1. @Override
  2. public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
  3. TableDescriptor desc, RegionInfo[] regions) throws IOException {
  4. if (desc.getTableName().equals(TABLE)) {
  5. throw new AccessDeniedException("Don't allow creation of table");
  6. }
  7. }

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

  1. @Override
  2. public void preCreateTableAction(
  3. final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableDescriptor desc,
  4. final RegionInfo[] regions) throws IOException {
  5. if (desc.getTableName().equals(TABLE)) {
  6. throw new AccessDeniedException("Don't allow creation of table");
  7. }
  8. }

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

  1. @Override
  2. public void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
  3. RegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
  4. // only keep primary region's edits
  5. if (logKey.getTableName().equals(tableName) && info.getReplicaId() == 0) {
  6. // Presume type is a WALKeyImpl
  7. entries.add(new Entry((WALKeyImpl)logKey, logEdit));
  8. }
  9. }
  10. }

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

  1. protected boolean isTestTable(FakeRSRpcServices rpcServices,
  2. HBaseProtos.RegionSpecifier regionSpec) throws ServiceException {
  3. try {
  4. return TABLE_NAME.equals(
  5. rpcServices.getRegion(regionSpec).getTableDescriptor().getTableName());
  6. } catch (IOException ioe) {
  7. throw new ServiceException(ioe);
  8. }
  9. }

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

  1. @Override
  2. public void init(RegionCoprocessorEnvironment e) throws IOException {
  3. this.scanLabelGenerators = VisibilityUtils.getScanLabelGenerators(this.conf);
  4. if (e.getRegion().getRegionInfo().getTable().equals(LABELS_TABLE_NAME)) {
  5. this.labelsRegion = e.getRegion();
  6. }
  7. }

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

  1. @Test
  2. public void testGetTableDescriptor() throws Exception {
  3. ThriftHBaseServiceHandler handler = createHandler();
  4. TTableDescriptor tableDescriptor = handler
  5. .getTableDescriptor(ThriftUtilities.tableNameFromHBase(TableName.valueOf(tableAname)));
  6. TableDescriptor table = ThriftUtilities.tableDescriptorFromThrift(tableDescriptor);
  7. assertTrue(table.getTableName().equals(TableName.valueOf(tableAname)));
  8. assertTrue(table.getColumnFamilies().length == 2);
  9. assertTrue(table.getColumnFamily(familyAname).getMaxVersions() == 3);
  10. assertTrue(table.getColumnFamily(familyBname).getMaxVersions() == 2);
  11. }

相关文章