@Override public List<String> apply(List<com.google.bigtable.admin.v2.Table> protos) { List<String> results = Lists.newArrayListWithCapacity(protos.size()); for (com.google.bigtable.admin.v2.Table proto : protos) { results.add(NameUtil.extractTableIdFromTableName(proto.getName())); } return results; } },
@InternalApi public static Table fromProto(@Nonnull com.google.bigtable.admin.v2.Table proto) { ImmutableMap.Builder<String, ReplicationState> replicationStates = ImmutableMap.builder(); for (Entry<String, com.google.bigtable.admin.v2.Table.ClusterState> entry : proto.getClusterStatesMap().entrySet()) { replicationStates.put( entry.getKey(), ReplicationState.fromProto(entry.getValue().getReplicationState())); } ImmutableList.Builder<ColumnFamily> columnFamilies = ImmutableList.builder(); for (Entry<String, com.google.bigtable.admin.v2.ColumnFamily> entry : proto.getColumnFamiliesMap().entrySet()) { columnFamilies.add(ColumnFamily.fromProto(entry.getKey(), entry.getValue())); } return new Table( TableName.parse(proto.getName()), replicationStates.build(), columnFamilies.build()); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.Table)) { return super.equals(obj); } com.google.bigtable.admin.v2.Table other = (com.google.bigtable.admin.v2.Table) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && internalGetClusterStates().equals(other.internalGetClusterStates()); result = result && internalGetColumnFamilies().equals(other.internalGetColumnFamilies()); result = result && granularity_ == other.granularity_; result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * (`OutputOnly`) * The unique name of the table. Values are of the form * `projects/<project>/instances/<instance>/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. * Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL` * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (!internalGetClusterStates().getMap().isEmpty()) { hash = (37 * hash) + CLUSTER_STATES_FIELD_NUMBER; hash = (53 * hash) + internalGetClusterStates().hashCode(); } if (!internalGetColumnFamilies().getMap().isEmpty()) { hash = (37 * hash) + COLUMN_FAMILIES_FIELD_NUMBER; hash = (53 * hash) + internalGetColumnFamilies().hashCode(); } hash = (37 * hash) + GRANULARITY_FIELD_NUMBER; hash = (53 * hash) + granularity_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.bigtable.admin.v2.Table other) { if (other == com.google.bigtable.admin.v2.Table.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } internalGetMutableClusterStates().mergeFrom(other.internalGetClusterStates()); internalGetMutableColumnFamilies().mergeFrom(other.internalGetColumnFamilies()); if (other.granularity_ != 0) { setGranularityValue(other.getGranularityValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
expectedResults.add(TableName.parse(expectedProto.getName()).getTable());
@Override public List<String> apply(List<com.google.bigtable.admin.v2.Table> protos) { List<String> results = Lists.newArrayListWithCapacity(protos.size()); for (com.google.bigtable.admin.v2.Table proto : protos) { results.add(NameUtil.extractTableIdFromTableName(proto.getName())); } return results; } },
/** * Convert a list of Bigtable {@link Table}s to hbase {@link TableName}. */ private TableName[] asTableNames(List<Table> tablesList) { TableName[] result = new TableName[tablesList.size()]; for (int i = 0; i < tablesList.size(); i++) { // This will contain things like project, zone and cluster. String bigtableFullTableName = tablesList.get(i).getName(); // Strip out the Bigtable info. String name = bigtableInstanceName.toTableId(bigtableFullTableName); result[i] = TableName.valueOf(name); } return result; }
private CompletableFuture<List<TableDescriptor>> listTables(Optional<Pattern> tableNamePattern) { return requestTableList().thenApply(r -> r.stream() .filter(t -> !tableNamePattern.isPresent() || tableNamePattern.get().matcher(bigtableInstanceName.toTableId(t.getName())).matches()) .map(tableAdapter2x::adapt) .collect(Collectors.toList()) ); }
private CompletableFuture<List<TableName>> listTableNames(Optional<Pattern> tableNamePattern) { return requestTableList().thenApply(r -> r.stream().map(e -> bigtableInstanceName.toTableId(e.getName())) .filter(e -> !tableNamePattern.isPresent() || tableNamePattern.get().matcher(e).matches()) .map(TableName::valueOf) .collect(Collectors.toList()) ); }
private CompletableFuture<List<TableName>> listTableNames(Optional<Pattern> tableNamePattern) { return requestTableList().thenApply(r -> r.stream().map(e -> bigtableInstanceName.toTableId(e.getName())) .filter(e -> !tableNamePattern.isPresent() || tableNamePattern.get().matcher(e).matches()) .map(TableName::valueOf) .collect(Collectors.toList()) ); }
private CompletableFuture<List<TableDescriptor>> listTables(Optional<Pattern> tableNamePattern) { return requestTableList().thenApply(r -> r.stream() .filter(t -> !tableNamePattern.isPresent() || tableNamePattern.get().matcher(bigtableInstanceName.toTableId(t.getName())).matches()) .map(tableAdapter2x::adapt) .collect(Collectors.toList()) ); }
@Override public List<String> apply(ListTablesResponse input) { ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for(com.google.bigtable.admin.v2.Table tableProto : input.getTablesList()){ tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); } }, MoreExecutors.directExecutor());
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.Table)) { return super.equals(obj); } com.google.bigtable.admin.v2.Table other = (com.google.bigtable.admin.v2.Table) obj; boolean result = true; result = result && getName() .equals(other.getName()); result = result && internalGetColumnFamilies().equals( other.internalGetColumnFamilies()); result = result && granularity_ == other.granularity_; return result; }
private static SnapshotDescription toSnapshotDescription(Snapshot snapshot) { return new SnapshotDescription( snapshot.getName(), TableName.valueOf(snapshot.getSourceTable().getName())); }
private static SnapshotDescription toSnapshotDescription(Snapshot snapshot) { return new SnapshotDescription( snapshot.getName(), TableName.valueOf(snapshot.getSourceTable().getName())); }
/** {@inheritDoc} */ @Override public List<String> listTables() { ListTablesRequest requestProto = ListTablesRequest.newBuilder() .setParent(instanceName.toString()) .build(); ListTablesResponse response = adminClient.listTables(requestProto); ImmutableList.Builder<String> tableIdsBuilder = ImmutableList.builder(); for(com.google.bigtable.admin.v2.Table tableProto : response.getTablesList()){ tableIdsBuilder.add(instanceName.toTableId(tableProto.getName())); } return tableIdsBuilder.build(); }
public Builder mergeFrom(com.google.bigtable.admin.v2.Table other) { if (other == com.google.bigtable.admin.v2.Table.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } internalGetMutableColumnFamilies().mergeFrom( other.internalGetColumnFamilies()); if (other.granularity_ != 0) { setGranularityValue(other.getGranularityValue()); } onChanged(); return this; }
@Override public List<SnapshotDescription> listSnapshots() throws IOException { ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder() .setParent(getSnapshotClusterName().toString()) .build(); ListSnapshotsResponse snapshotList = Futures.getChecked(bigtableTableAdminClient .listSnapshotsAsync(request), IOException.class); List<SnapshotDescription> response = new ArrayList<>(); for (Snapshot snapshot : snapshotList.getSnapshotsList()) { response.add(new SnapshotDescription( snapshot.getName(), TableName.valueOf(snapshot.getSourceTable().getName()))); } return response; }