@Override public ApiFuture<Void> futureCall(final TableName tableName, final ApiCallContext context) { ApiFuture<GenerateConsistencyTokenResponse> tokenFuture = generateToken(tableName, context); return ApiFutures.transformAsync( tokenFuture, new ApiAsyncFunction<GenerateConsistencyTokenResponse, Void>() { @Override public ApiFuture<Void> apply(GenerateConsistencyTokenResponse input) { CheckConsistencyRequest request = CheckConsistencyRequest.newBuilder() .setName(tableName.toString()) .setConsistencyToken(input.getConsistencyToken()) .build(); return pollToken(request, context); } }, MoreExecutors.directExecutor()); }
@Override public ApiFuture<List<com.google.bigtable.admin.v2.Table>> apply( ListTablesPage page) { // Add all entries from the page responseAccumulator.addAll(Lists.newArrayList(page.getValues())); // If this is the last page, just return the accumulated responses. if (!page.hasNextPage()) { return ApiFutures.immediateFuture(responseAccumulator); } // Otherwise fetch the next page. return ApiFutures.transformAsync( page.getNextPageAsync(), this, MoreExecutors.directExecutor()); } },
@Override public ApiFuture<List<com.google.bigtable.admin.v2.AppProfile>> apply( ListAppProfilesPage page) { // Add all entries from the page responseAccumulator.addAll(Lists.newArrayList(page.getValues())); // If this is the last page, just return the accumulated responses. if (!page.hasNextPage()) { return ApiFutures.immediateFuture(responseAccumulator); } // Otherwise fetch the next page. return ApiFutures.transformAsync( page.getNextPageAsync(), this, MoreExecutors.directExecutor()); } },
ApiFutures.transformAsync( firstPageFuture, new ApiAsyncFunction<
ApiFutures.transformAsync( firstPageFuture, new ApiAsyncFunction<ListTablesPage, List<com.google.bigtable.admin.v2.Table>>() {
@Override public ApiFuture<Void> futureCall(final TableName tableName, final ApiCallContext context) { ApiFuture<GenerateConsistencyTokenResponse> tokenFuture = generateToken(tableName, context); return ApiFutures.transformAsync( tokenFuture, new ApiAsyncFunction<GenerateConsistencyTokenResponse, Void>() { @Override public ApiFuture<Void> apply(GenerateConsistencyTokenResponse input) { CheckConsistencyRequest request = CheckConsistencyRequest.newBuilder() .setName(tableName.toString()) .setConsistencyToken(input.getConsistencyToken()) .build(); return pollToken(request, context); } }, MoreExecutors.directExecutor()); }
public static <V, X> ApiFuture<X> transformAsync( ApiFuture<V> input, final ApiAsyncFunction<V, X> function, @NonNull FirebaseApp app) { return ApiFutures.transformAsync(input, function, app.getScheduledExecutorService()); }
@Override public ApiFuture<List<com.google.bigtable.admin.v2.Table>> apply( ListTablesPage page) { // Add all entries from the page responseAccumulator.addAll(Lists.newArrayList(page.getValues())); // If this is the last page, just return the accumulated responses. if (!page.hasNextPage()) { return ApiFutures.immediateFuture(responseAccumulator); } // Otherwise fetch the next page. return ApiFutures.transformAsync( page.getNextPageAsync(), this, MoreExecutors.directExecutor()); } },
@Override public ApiFuture<List<com.google.bigtable.admin.v2.AppProfile>> apply( ListAppProfilesPage page) { // Add all entries from the page responseAccumulator.addAll(Lists.newArrayList(page.getValues())); // If this is the last page, just return the accumulated responses. if (!page.hasNextPage()) { return ApiFutures.immediateFuture(responseAccumulator); } // Otherwise fetch the next page. return ApiFutures.transformAsync( page.getNextPageAsync(), this, MoreExecutors.directExecutor()); } },
ApiFutures.transformAsync( firstPageFuture, new ApiAsyncFunction<
ApiFutures.transformAsync( firstPageFuture, new ApiAsyncFunction<ListTablesPage, List<com.google.bigtable.admin.v2.Table>>() {