当前位置: 首页>>代码示例>>Java>>正文


Java BatchWriter.addMutations方法代码示例

本文整理汇总了Java中org.apache.accumulo.core.client.BatchWriter.addMutations方法的典型用法代码示例。如果您正苦于以下问题:Java BatchWriter.addMutations方法的具体用法?Java BatchWriter.addMutations怎么用?Java BatchWriter.addMutations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.accumulo.core.client.BatchWriter的用法示例。


在下文中一共展示了BatchWriter.addMutations方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeData

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
/**
 * Writes the given data to Accumulo. The full combinatorial of values is written.
 *
 * @param rows
 *          Rows to write.
 * @param colFs
 *          Column families to write.
 * @param colQs
 *          Column qualifiers to write.
 * @param colVs
 *          Column visibilities to write.
 * @param values
 *          Values to write.
 */
private static void writeData(BatchWriter writer, Iterable<String> rows, Iterable<String> colFs, Iterable<String> colQs, Iterable<String> colVs,
    Iterable<String> values) throws MutationsRejectedException {
  List<Mutation> mutations = new ArrayList<>();

  for (String row : rows) {
    Mutation mutation = new Mutation(row);
    mutations.add(mutation);

    for (String colF : colFs) {
      for (String colQ : colQs) {
        for (String colV : colVs) {
          for (String value : values) {
            mutation.put(colF, colQ, new ColumnVisibility(colV), value);
          }
        }
      }
    }
  }

  writer.addMutations(mutations);
  writer.flush();
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:37,代码来源:FilteringIT.java

示例2: addMutationsTest

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
@Test
public void addMutationsTest() throws Exception {
  when(mockConnector.createBatchWriter(TEST_TABLE, null)).thenReturn(mockWriter);

  BatchWriter writer = new SignedBatchWriter(mockConnector, TEST_TABLE, null, getConfig("config1.ini"), aliceKeyContainers.get(ValueSigner.RSA_PSS));

  List<Mutation> mutations = new ArrayList<>();
  Mutation mutation = new Mutation("row");
  mutation.put("colF", "colQ", "val");

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(1)).addMutation(any()); // 1 time
  verify(mockSignatureWriter, never()).addMutation(any());

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(3)).addMutation(any()); // 1 + 2 times
  verify(mockSignatureWriter, never()).addMutation(any());

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(6)).addMutation(any()); // 1 + 2 + 3 times
  verify(mockSignatureWriter, never()).addMutation(any());
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:26,代码来源:SignedBatchWriterTest.java

示例3: addMutationsExternalTest

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
@Test
public void addMutationsExternalTest() throws Exception {
  when(mockConnector.createBatchWriter(TEST_TABLE, null)).thenReturn(mockWriter);
  when(mockConnector.createBatchWriter(SIG_TABLE, null)).thenReturn(mockSignatureWriter);

  BatchWriter writer = new SignedBatchWriter(mockConnector, TEST_TABLE, null, getConfig("config3.ini"), aliceKeyContainers.get(ValueSigner.ECDSA));

  List<Mutation> mutations = new ArrayList<>();
  Mutation mutation = new Mutation("row");
  mutation.put("colF", "colQ", "val");

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(1)).addMutation(any()); // 1 time
  verify(mockSignatureWriter, times(1)).addMutation(any()); // 1 time

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(3)).addMutation(any()); // 1 + 2 times
  verify(mockSignatureWriter, times(3)).addMutation(any()); // 1 + 2 times

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(6)).addMutation(any()); // 1 + 2 + 3 times
  verify(mockSignatureWriter, times(6)).addMutation(any()); // 1 + 2 + 3 times
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:27,代码来源:SignedBatchWriterTest.java

示例4: addMutationsTest

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
@Test
public void addMutationsTest() throws Exception {
  when(mockConnector.createBatchWriter(TEST_TABLE, null)).thenReturn(mockWriter);
  BatchWriter writer = new EncryptedBatchWriter(mockConnector, TEST_TABLE, null, getConfig("encrypt-value.ini"), KEYS);

  List<Mutation> mutations = new ArrayList<>();
  Mutation mutation = new Mutation("row");
  mutation.put("colF", "colQ", "val");

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(1)).addMutation(any()); // 1 time

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(3)).addMutation(any()); // 1 + 2 times

  mutations.add(mutation);
  writer.addMutations(mutations);
  verify(mockWriter, times(6)).addMutation(any()); // 1 + 2 + 3 times
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:22,代码来源:EncryptedBatchWriterTest.java

示例5: benchmark

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
/**
 * Benchmark creating the writer, writing the entries, and closing the writer.
 * <p>
 * Generation of entries is also benchmarked. These could be generated before the fact, but that significantly increases the memory strain on the benchmark.
 */
@Benchmark
public void benchmark() throws Exception {
  BatchWriter writer = getSignedBatchWriter(configFile, TEST_TABLE);
  writer.addMutations(mutations);
  writer.close();
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:12,代码来源:SignatureWriteBenchmark.java

示例6: benchmark

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
/**
 * Benchmark creating the writer, writing the entries, and closing the writer.
 * <p>
 * Generation of entries is also benchmarked. These could be generated before the fact, but that significantly increases the memory strain on the benchmark.
 */
@Benchmark
public void benchmark() throws Exception {
  BatchWriter writer = getEncryptedBatchWriter(configFile, TEST_TABLE);
  writer.addMutations(mutations);
  writer.close();
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:12,代码来源:EncryptionWriteBenchmark.java

示例7: apply

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
public static void apply(BatchWriter writer, Mutator mut) {
  try {
    writer.addMutations(mut.create());
  } catch (MutationsRejectedException e) {
    throw new AccumuloGraphException(e);
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:8,代码来源:Mutators.java

示例8: serialize

import org.apache.accumulo.core.client.BatchWriter; //导入方法依赖的package包/类
public static void serialize(Tracer t, Connector c) throws TableNotFoundException, MutationsRejectedException {
  checkNotNull(t);
  checkNotNull(c);
  
  BatchWriter bw = c.createBatchWriter(TABLE_NAME, BW_CONFIG_INSTANCE);
  try {
    bw.addMutations(t.toMutations());
  } finally {
    bw.close();
  }
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:12,代码来源:AccumuloTraceStore.java


注:本文中的org.apache.accumulo.core.client.BatchWriter.addMutations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。