本文整理汇总了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();
}
示例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());
}
示例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
}
示例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
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
}