MCPcopy Create free account
hub / github.com/bytedance/terarkdb / data

Method data

java/src/test/java/org/rocksdb/WriteBatchTest.java:312–339  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310 }
311
312 @Test
313 public void data() throws RocksDBException {
314 try (final WriteBatch batch1 = new WriteBatch()) {
315 batch1.delete("k0".getBytes());
316 batch1.put("k1".getBytes(), "v1".getBytes());
317 batch1.put("k2".getBytes(), "v2".getBytes());
318 batch1.put("k3".getBytes(), "v3".getBytes());
319 batch1.putLogData("log1".getBytes());
320 batch1.merge("k2".getBytes(), "v22".getBytes());
321 batch1.delete("k3".getBytes());
322
323 final byte[] serialized = batch1.data();
324
325 try(final WriteBatch batch2 = new WriteBatch(serialized)) {
326 assertThat(batch2.count()).isEqualTo(batch1.count());
327
328 try(final CapturingWriteBatchHandler handler1 = new CapturingWriteBatchHandler()) {
329 batch1.iterate(handler1);
330
331 try (final CapturingWriteBatchHandler handler2 = new CapturingWriteBatchHandler()) {
332 batch2.iterate(handler2);
333
334 assertThat(handler1.getEvents().equals(handler2.getEvents())).isTrue();
335 }
336 }
337 }
338 }
339 }
340
341 @Test
342 public void dataSize() throws RocksDBException {

Callers 7

iterateUpperBoundMethod · 0.45
iterateLowerBoundMethod · 0.45
copyConstructorMethod · 0.45
compareMethod · 0.45
iteratorMethod · 0.45
sliceMethod · 0.45
compareMethod · 0.45

Calls 9

iterateMethod · 0.80
isTrueMethod · 0.80
getEventsMethod · 0.80
deleteMethod · 0.65
putMethod · 0.65
putLogDataMethod · 0.65
mergeMethod · 0.65
countMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected