當前位置: 首頁>>代碼示例>>Java>>正文


Java BulkOptions類代碼示例

本文整理匯總了Java中com.google.cloud.bigtable.config.BulkOptions的典型用法代碼示例。如果您正苦於以下問題:Java BulkOptions類的具體用法?Java BulkOptions怎麽用?Java BulkOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BulkOptions類屬於com.google.cloud.bigtable.config包,在下文中一共展示了BulkOptions類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testWriteWithBigTableOptionsSetsBulkOptionsAndRetryOptions

import com.google.cloud.bigtable.config.BulkOptions; //導入依賴的package包/類
@Test
public void testWriteWithBigTableOptionsSetsBulkOptionsAndRetryOptions() {
  final int maxInflightRpcs = 1;
  final int initialBackoffMillis = -1;

  BigtableOptions.Builder optionsBuilder = BIGTABLE_OPTIONS.toBuilder();

  BulkOptions.Builder bulkOptionsBuilder = new BulkOptions.Builder();
  bulkOptionsBuilder.setMaxInflightRpcs(maxInflightRpcs);

  RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder();
  retryOptionsBuilder.setInitialBackoffMillis(initialBackoffMillis);

  optionsBuilder.setBulkOptions(bulkOptionsBuilder.build())
      .setRetryOptions(retryOptionsBuilder.build());

  BigtableIO.Write write =
      BigtableIO.write().withBigtableOptions(optionsBuilder.build());

  BigtableOptions options = write.getBigtableOptions();
  assertEquals(true, options.getBulkOptions().useBulkApi());
  assertEquals(maxInflightRpcs, options.getBulkOptions().getMaxInflightRpcs());
  assertEquals(initialBackoffMillis, options.getRetryOptions().getInitialBackoffMillis());

  assertThat(options.getBulkOptions(),
      Matchers.equalTo(bulkOptionsBuilder
          .setUseBulkApi(true)
          .build()));
  assertThat(options.getRetryOptions(),
      Matchers.equalTo(retryOptionsBuilder.build()));
}
 
開發者ID:apache,項目名稱:beam,代碼行數:32,代碼來源:BigtableIOTest.java

示例2: call

import com.google.cloud.bigtable.config.BulkOptions; //導入依賴的package包/類
@Override
public BigtableConnection call() throws Exception {
    final CredentialOptions credentials = this.credentials.build();

    final RetryOptions retryOptions = new RetryOptions.Builder()
        .addStatusToRetryOn(Status.Code.UNKNOWN)
        .setAllowRetriesWithoutTimestamp(true)
        .build();

    final BulkOptions bulkOptions = batchSize
        .map(integer -> new BulkOptions.Builder().setBulkMaxRowKeyCount(integer).build())
        .orElseGet(() -> new BulkOptions.Builder().build());

    final BigtableOptions options = new BigtableOptions.Builder()
        .setProjectId(project)
        .setInstanceId(instance)
        .setUserAgent(USER_AGENT)
        .setDataChannelCount(64)
        .setCredentialOptions(credentials)
        .setRetryOptions(retryOptions)
        .setBulkOptions(bulkOptions)
        .build();

    final BigtableSession session = new BigtableSession(options);

    final BigtableTableAdminClient adminClient =
        new BigtableTableTableAdminClientImpl(async, session.getTableAdminClient(), project,
            instance);

    final BigtableMutator mutator =
        new BigtableMutatorImpl(async, session, disableBulkMutations, flushIntervalSeconds);

    final BigtableDataClient client =
        new BigtableDataClientImpl(async, session, mutator, project, instance);

    return new GrpcBigtableConnection(async, project, instance, session, mutator, adminClient,
        client);
}
 
開發者ID:spotify,項目名稱:heroic,代碼行數:39,代碼來源:BigtableConnectionBuilder.java


注:本文中的com.google.cloud.bigtable.config.BulkOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。