/** * Creates a new snapshot from a table in a specific cluster. * @param request a {@link SnapshotTableRequest} object. * @return The long running {@link Operation} for the request. */ public CompletableFuture<Operation> snapshotTableAsync(SnapshotTableRequest request) { return toCompletableFuture(adminClient.snapshotTableAsync(request)); }
/** * Creates a new snapshot from a table in a specific cluster. * @param request a {@link SnapshotTableRequest} object. * @return The long running {@link Operation} for the request. */ public CompletableFuture<Operation> snapshotTableAsync(SnapshotTableRequest request) { return toCompletableFuture(adminClient.snapshotTableAsync(request)); }
/** * Creates a snapshot from an existing table. NOTE: Cloud Bigtable has a cleanup policy * * @param snapshotName * @param tableName * @return * @throws IOException */ protected Operation snapshotTable(String snapshotName, TableName tableName) throws IOException { SnapshotTableRequest.Builder requestBuilder = SnapshotTableRequest.newBuilder() .setCluster(getSnapshotClusterName().toString()) .setSnapshotId(snapshotName) .setName(options.getInstanceName().toTableNameStr(tableName.getNameAsString())); int ttlSecs = configuration.getInt(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_DEFAULT_TTL_SECS_KEY, -1); if (ttlSecs > 0) { requestBuilder.setTtl( Duration.newBuilder().setSeconds(ttlSecs).build() ); } ListenableFuture<Operation> future = bigtableTableAdminClient .snapshotTableAsync(requestBuilder.build()); return Futures.getChecked(future, IOException.class); }
/** * Creates a snapshot from an existing table. NOTE: Cloud Bigtable has a cleanup policy * * @param snapshotName * @param tableName * @return * @throws IOException */ protected Operation snapshotTable(String snapshotName, TableName tableName) throws IOException { SnapshotTableRequest.Builder requestBuilder = SnapshotTableRequest.newBuilder() .setCluster(getSnapshotClusterName().toString()) .setSnapshotId(snapshotName) .setName(options.getInstanceName().toTableNameStr(tableName.getNameAsString())); int ttlSecs = configuration.getInt(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_DEFAULT_TTL_SECS_KEY, -1); if (ttlSecs > 0) { requestBuilder.setTtl( Duration.newBuilder().setSeconds(ttlSecs).build() ); } ListenableFuture<Operation> future = bigtableTableAdminClient .snapshotTableAsync(requestBuilder.build()); return Futures.getChecked(future, IOException.class); }