• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Mutation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.bigtable.v2.Mutation的典型用法代码示例。如果您正苦于以下问题:Java Mutation类的具体用法?Java Mutation怎么用?Java Mutation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Mutation类属于com.google.bigtable.v2包,在下文中一共展示了Mutation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processElement

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@ProcessElement
public void processElement(ProcessContext c) {
	InputContent i = c.element();
	String jobName = c.getPipelineOptions().getJobName();
	ByteString rowkey = ByteString.copyFromUtf8(jobName + "#" + i.expectedDocumentHash); 
	ByteString value = ByteString.copyFromUtf8(i.text);
	
	Iterable<Mutation> mutations =
		ImmutableList.of(Mutation.newBuilder()
			.setSetCell(
				Mutation.SetCell.newBuilder()
					.setFamilyName(IndexerPipelineUtils.DEAD_LETTER_TABLE_ERR_CF)
					.setColumnQualifier(ByteString.copyFromUtf8("text"))
					.setValue(value)
			)
               .build());
	
	c.output(KV.of(rowkey, mutations));			
}
 
开发者ID:GoogleCloudPlatform,项目名称:dataflow-opinion-analysis,代码行数:20,代码来源:FileIndexerPipeline.java


示例2: testDeleteRow

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testDeleteRow() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl = (BigtableMutationImpl) this.bigtableMutation.deleteRow();
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(1, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());
  final Mutation mutation = bigtableMutationImpl.getMutateRowRequest().getMutations(0);
  assertEquals(Mutation.MutationCase.DELETE_FROM_ROW, mutation.getMutationCase());
  assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
  assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
  assertEquals(Mutation.DeleteFromColumn.getDefaultInstance(), mutation.getDeleteFromColumn());
  assertEquals(Mutation.SetCell.getDefaultInstance(), mutation.getSetCell());

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:21,代码来源:BigtableMutationImplTest.java


示例3: testWritingFailsTableDoesNotExist

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
/** Tests that when writing to a non-existent table, the write fails. */
@Test
public void testWritingFailsTableDoesNotExist() throws Exception {
  final String table = "TEST-TABLE";

  PCollection<KV<ByteString, Iterable<Mutation>>> emptyInput =
      p.apply(
          Create.empty(
              KvCoder.of(ByteStringCoder.of(), IterableCoder.of(ProtoCoder.of(Mutation.class)))));

  // Exception will be thrown by write.validate() when writeToDynamic is applied.
  thrown.expect(IllegalArgumentException.class);
  thrown.expectMessage(String.format("Table %s does not exist", table));

  emptyInput.apply("write", defaultWrite.withTableId(table));
  p.run();
}
 
开发者ID:apache,项目名称:beam,代码行数:18,代码来源:BigtableIOTest.java


示例4: deleteCellsFromColumn

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Override
public BigtableMutation deleteCellsFromColumn(final String columnFamily,
                                              final String columnQualifier,
                                              final Optional<Long> startTimestampMicros,
                                              final Optional<Long> endTimestampMicros) {
  final TimestampRange.Builder timestampRange = TimestampRange.newBuilder();
  startTimestampMicros.ifPresent(timestampRange::setStartTimestampMicros);
  endTimestampMicros.ifPresent(timestampRange::setEndTimestampMicros);

  final Mutation.DeleteFromColumn.Builder deleteFromColumn =
      Mutation.DeleteFromColumn.newBuilder()
          .setFamilyName(columnFamily)
          .setColumnQualifier(ByteString.copyFromUtf8(columnQualifier))
          .setTimeRange(timestampRange);

  mutateRowRequest.addMutations(Mutation.newBuilder().setDeleteFromColumn(deleteFromColumn));
  return this;
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:19,代码来源:BigtableMutationImpl.java


示例5: testDeleteColumnFamily

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testDeleteColumnFamily() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl =
          (BigtableMutationImpl) this.bigtableMutation.deleteColumnFamily("family");
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(1, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());
  final Mutation mutation = bigtableMutationImpl.getMutateRowRequest().getMutations(0);
  assertEquals(Mutation.MutationCase.DELETE_FROM_FAMILY, mutation.getMutationCase());
  assertEquals("family", mutation.getDeleteFromFamily().getFamilyName());
  assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
  assertEquals(Mutation.DeleteFromColumn.getDefaultInstance(), mutation.getDeleteFromColumn());
  assertEquals(Mutation.SetCell.getDefaultInstance(), mutation.getSetCell());

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:22,代码来源:BigtableMutationImplTest.java


示例6: testDeleteColumn

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testDeleteColumn() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl =
          (BigtableMutationImpl) this.bigtableMutation.deleteColumn("family:qualifier");
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(1, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());
  final Mutation mutation = bigtableMutationImpl.getMutateRowRequest().getMutations(0);
  assertEquals(Mutation.MutationCase.DELETE_FROM_COLUMN, mutation.getMutationCase());
  assertEquals("family", mutation.getDeleteFromColumn().getFamilyName());
  assertEquals("qualifier", mutation.getDeleteFromColumn().getColumnQualifier().toStringUtf8());
  assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
  assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
  assertEquals(Mutation.SetCell.getDefaultInstance(), mutation.getSetCell());

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:23,代码来源:BigtableMutationImplTest.java


示例7: testDeleteColumnFamilyAndQualifier

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testDeleteColumnFamilyAndQualifier() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl =
          (BigtableMutationImpl) this.bigtableMutation.deleteColumn("family", "qualifier");
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(1, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());
  final Mutation mutation = bigtableMutationImpl.getMutateRowRequest().getMutations(0);
  assertEquals(Mutation.MutationCase.DELETE_FROM_COLUMN, mutation.getMutationCase());
  assertEquals("family", mutation.getDeleteFromColumn().getFamilyName());
  assertEquals("qualifier", mutation.getDeleteFromColumn().getColumnQualifier().toStringUtf8());
  assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
  assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
  assertEquals(Mutation.SetCell.getDefaultInstance(), mutation.getSetCell());

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:23,代码来源:BigtableMutationImplTest.java


示例8: writeRecord

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Override
public ListenableFuture<MutateRowResponse> writeRecord(
    KV<ByteString, Iterable<Mutation>> record)
    throws IOException {
  MutateRowRequest r =
      MutateRowRequest.newBuilder()
          .setTableName(tableName)
          .setRowKey(record.getKey())
          .addAllMutations(record.getValue())
          .build();
  return bulkMutation.add(r);
}
 
开发者ID:apache,项目名称:beam,代码行数:13,代码来源:BigtableServiceImpl.java


示例9: expand

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Override
public PDone expand(PCollection<KV<ByteString, Iterable<Mutation>>> input) {
  getBigtableConfig().validate();

  input.apply(ParDo.of(new BigtableWriterFn(getBigtableConfig().getTableId(),
      new SerializableFunction<PipelineOptions, BigtableService>() {
        @Override
        public BigtableService apply(PipelineOptions options) {
          return getBigtableConfig().getBigtableService(options);
        }
      })));
  return PDone.in(input.getPipeline());
}
 
开发者ID:apache,项目名称:beam,代码行数:14,代码来源:BigtableIO.java


示例10: BigtableWriteException

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
public BigtableWriteException(KV<ByteString, Iterable<Mutation>> record, Throwable cause) {
  super(
      String.format(
          "Error mutating row %s with mutations %s",
          record.getKey().toStringUtf8(),
          record.getValue()),
      cause);
}
 
开发者ID:apache,项目名称:beam,代码行数:9,代码来源:BigtableIO.java


示例11: testCoderInference

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testCoderInference() {
  SerializableFunction<SchemaAndRecord, KV<ByteString, Mutation>> parseFn =
      new SerializableFunction<SchemaAndRecord, KV<ByteString, Mutation>>() {
        @Override
        public KV<ByteString, Mutation> apply(SchemaAndRecord input) {
          return null;
        }
      };

  assertEquals(
      KvCoder.of(ByteStringCoder.of(), ProtoCoder.of(Mutation.class)),
      BigQueryIO.read(parseFn).inferCoder(CoderRegistry.createDefault()));
}
 
开发者ID:apache,项目名称:beam,代码行数:15,代码来源:BigQueryIOReadTest.java


示例12: testE2EBigtableWrite

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testE2EBigtableWrite() throws Exception {
  final String tableName = bigtableOptions.getInstanceName().toTableNameStr(tableId);
  final String instanceName = bigtableOptions.getInstanceName().toString();
  final int numRows = 1000;
  final List<KV<ByteString, ByteString>> testData = generateTableData(numRows);

  createEmptyTable(instanceName, tableId);

  Pipeline p = Pipeline.create(options);
  p.apply(GenerateSequence.from(0).to(numRows))
      .apply(ParDo.of(new DoFn<Long, KV<ByteString, Iterable<Mutation>>>() {
        @ProcessElement
        public void processElement(ProcessContext c) {
          int index = c.element().intValue();

          Iterable<Mutation> mutations =
              ImmutableList.of(Mutation.newBuilder()
                  .setSetCell(
                      Mutation.SetCell.newBuilder()
                          .setValue(testData.get(index).getValue())
                          .setFamilyName(COLUMN_FAMILY_NAME))
                  .build());
          c.output(KV.of(testData.get(index).getKey(), mutations));
        }
      }))
      .apply(BigtableIO.write()
        .withBigtableOptions(bigtableOptions)
        .withTableId(tableId));
  p.run();

  // Test number of column families and column family name equality
  Table table = getTable(tableName);
  assertThat(table.getColumnFamiliesMap().keySet(), Matchers.hasSize(1));
  assertThat(table.getColumnFamiliesMap(), Matchers.hasKey(COLUMN_FAMILY_NAME));

  // Test table data equality
  List<KV<ByteString, ByteString>> tableData = getTableData(tableName);
  assertThat(tableData, Matchers.containsInAnyOrder(testData.toArray()));
}
 
开发者ID:apache,项目名称:beam,代码行数:41,代码来源:BigtableWriteIT.java


示例13: makeWrite

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
/** Helper function to make a single row mutation to be written. */
private static KV<ByteString, Iterable<Mutation>> makeWrite(String key, String value) {
  ByteString rowKey = ByteString.copyFromUtf8(key);
  Iterable<Mutation> mutations =
      ImmutableList.of(
          Mutation.newBuilder()
              .setSetCell(SetCell.newBuilder().setValue(ByteString.copyFromUtf8(value)))
              .build());
  return KV.of(rowKey, mutations);
}
 
开发者ID:apache,项目名称:beam,代码行数:11,代码来源:BigtableIOTest.java


示例14: writeRecord

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Override
public ListenableFuture<MutateRowResponse> writeRecord(
    KV<ByteString, Iterable<Mutation>> record) {
  service.verifyTableExists(tableId);
  Map<ByteString, ByteString> table = service.getTable(tableId);
  ByteString key = record.getKey();
  for (Mutation m : record.getValue()) {
    SetCell cell = m.getSetCell();
    if (cell.getValue().isEmpty()) {
      return Futures.immediateFailedCheckedFuture(new IOException("cell value missing"));
    }
    table.put(key, cell.getValue());
  }
  return Futures.immediateFuture(MutateRowResponse.getDefaultInstance());
}
 
开发者ID:apache,项目名称:beam,代码行数:16,代码来源:BigtableIOTest.java


示例15: deleteColumnFamily

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Override
public BigtableMutation deleteColumnFamily(String columnFamily) {
  final Mutation.DeleteFromFamily.Builder deleteFromFamily =
      Mutation.DeleteFromFamily.newBuilder().setFamilyName(columnFamily);
  mutateRowRequest.addMutations(Mutation.newBuilder().setDeleteFromFamily(deleteFromFamily));
  return this;
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:8,代码来源:BigtableMutationImpl.java


示例16: write

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Override
public BigtableMutation write(final String columnFamily, final String columnQualifier,
                              final ByteString value, final long timestampMicros) {
  final Mutation.SetCell.Builder setCell = Mutation.SetCell.newBuilder()
      .setFamilyName(columnFamily)
      .setColumnQualifier(ByteString.copyFromUtf8(columnQualifier))
      .setValue(value)
      .setTimestampMicros(timestampMicros);
  mutateRowRequest.addMutations(Mutation.newBuilder().setSetCell(setCell));
  return this;
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:12,代码来源:BigtableMutationImpl.java


示例17: testDeleteCellsFromColumn

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testDeleteCellsFromColumn() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl = (BigtableMutationImpl) this.bigtableMutation
          .deleteCellsFromColumn("family", "qualifier", Optional.empty(), Optional.empty())
          .deleteCellsFromColumn("family", "qualifier", Optional.of(100L), Optional.of(999L));
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(2, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());

  Mutation mutation = bigtableMutationImpl.getMutateRowRequest().getMutations(0);
  assertEquals(Mutation.MutationCase.DELETE_FROM_COLUMN, mutation.getMutationCase());
  assertEquals("family", mutation.getDeleteFromColumn().getFamilyName());
  assertEquals("qualifier", mutation.getDeleteFromColumn().getColumnQualifier().toStringUtf8());
  assertEquals(TimestampRange.getDefaultInstance(), mutation.getDeleteFromColumn().getTimeRange());
  assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
  assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
  assertEquals(Mutation.SetCell.getDefaultInstance(), mutation.getSetCell());

  mutation = bigtableMutationImpl.getMutateRowRequest().getMutations(1);
  assertEquals(Mutation.MutationCase.DELETE_FROM_COLUMN, mutation.getMutationCase());
  assertEquals("family", mutation.getDeleteFromColumn().getFamilyName());
  assertEquals("qualifier", mutation.getDeleteFromColumn().getColumnQualifier().toStringUtf8());
  assertEquals(100L, mutation.getDeleteFromColumn().getTimeRange().getStartTimestampMicros());
  assertEquals(999L, mutation.getDeleteFromColumn().getTimeRange().getEndTimestampMicros());
  assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
  assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
  assertEquals(Mutation.SetCell.getDefaultInstance(), mutation.getSetCell());

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:36,代码来源:BigtableMutationImplTest.java


示例18: testWriteColumnValue

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testWriteColumnValue() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl = (BigtableMutationImpl) this.bigtableMutation
          .write("family:qualifier", ByteString.copyFromUtf8("value"))
          .write("family", "qualifier", ByteString.copyFromUtf8("value"));
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(2, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());
  for (Mutation mutation : bigtableMutationImpl.getMutateRowRequest().getMutationsList()) {
    assertEquals(Mutation.MutationCase.SET_CELL, mutation.getMutationCase());
    assertEquals("family", mutation.getSetCell().getFamilyName());
    assertEquals("qualifier", mutation.getSetCell().getColumnQualifier().toStringUtf8());
    assertEquals("value", mutation.getSetCell().getValue().toStringUtf8());
    assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
    assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
    assertEquals(Mutation.DeleteFromColumn.getDefaultInstance(), mutation.getDeleteFromColumn());

    // Check timestamp in last 1 second
    final long tsMillis = TimeUnit.MICROSECONDS.toMillis(mutation.getSetCell().getTimestampMicros());
    final long nowMillis = System.currentTimeMillis();
    assertTrue(tsMillis <= nowMillis && tsMillis > nowMillis - TimeUnit.SECONDS.toMillis(1));
  }

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:31,代码来源:BigtableMutationImplTest.java


示例19: testWriteColumnAndTimestamp

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
@Test
public void testWriteColumnAndTimestamp() throws Exception {
  final BigtableMutationImpl bigtableMutationImpl = (BigtableMutationImpl) this.bigtableMutation
          .write("family:qualifier", ByteString.copyFromUtf8("value"), 100L)
          .write("family", "qualifier", ByteString.copyFromUtf8("value"), 100L);
  verifyGetMutateRowRequest();

  bigtableMutationImpl.execute();
  bigtableMutationImpl.executeAsync();

  assertEquals(2, bigtableMutationImpl.getMutateRowRequest().getMutationsCount());

  for (Mutation mutation : bigtableMutationImpl.getMutateRowRequest().getMutationsList()) {
    assertEquals(Mutation.MutationCase.SET_CELL, mutation.getMutationCase());
    assertEquals("family", mutation.getSetCell().getFamilyName());
    assertEquals("qualifier", mutation.getSetCell().getColumnQualifier().toStringUtf8());
    assertEquals("value", mutation.getSetCell().getValue().toStringUtf8());
    assertEquals(100L, mutation.getSetCell().getTimestampMicros());
    assertEquals(Mutation.DeleteFromRow.getDefaultInstance(), mutation.getDeleteFromRow());
    assertEquals(Mutation.DeleteFromFamily.getDefaultInstance(), mutation.getDeleteFromFamily());
    assertEquals(Mutation.DeleteFromColumn.getDefaultInstance(), mutation.getDeleteFromColumn());
  }

  verify(bigtableMock.getMockedDataClient()).mutateRow(bigtableMutation.getMutateRowRequest().build());
  verify(bigtableMock.getMockedDataClient()).mutateRowAsync(bigtableMutation.getMutateRowRequest().build());
  verifyNoMoreInteractions(bigtableMock.getMockedDataClient());
}
 
开发者ID:spotify,项目名称:simple-bigtable,代码行数:28,代码来源:BigtableMutationImplTest.java


示例20: mutateRow

import com.google.bigtable.v2.Mutation; //导入依赖的package包/类
public AsyncFuture<Void> mutateRow(final ByteString rowKey, final Mutations mutations) {
    return async.call(() -> {
        mutations.getMutations().forEach(mutation -> {
            switch (mutation.getMutationCase()) {
                case SET_CELL:
                    final Mutation.SetCell setCell = mutation.getSetCell();
                    final ColumnFamily columnFamily =
                        columnFamilies.get(Pair.of(table, setCell.getFamilyName()));

                    if (columnFamily == null) {
                        throw new IllegalArgumentException(
                            "no such column family: " + setCell.getFamilyName());
                    }

                    RowStorage rowStorage;

                    synchronized (lock) {
                        final Pair<ByteString, ColumnFamily> key =
                            Pair.of(rowKey, columnFamily);

                        rowStorage = rows.get(key);

                        if (rowStorage == null) {
                            rowStorage = new RowStorage(columnFamily);
                            rows.put(key, rowStorage);
                        }
                    }

                    rowStorage.runSetCell(setCell);
                    break;
                default:
                    throw new IllegalArgumentException(
                        "Unsupported mutation: " + mutation.getMutationCase());
            }
        });

        return null;
    });
}
 
开发者ID:spotify,项目名称:heroic,代码行数:40,代码来源:FakeBigtableConnection.java



注:本文中的com.google.bigtable.v2.Mutation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HelpSystem类代码示例发布时间:2022-05-22
下一篇:
Java JsonListEntry类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap