use of com.palantir.atlasdb.keyvalue.api.RangeRequest in project atlasdb by palantir.
the class AbstractTransactionTest method testRangesTransaction.
@Test
public void testRangesTransaction() {
Transaction t = startTransaction();
put(t, "row1", "col1", "v1");
t.commit();
RangeRequest allRange = RangeRequest.builder().batchHint(3).build();
t = startTransaction();
verifyAllGetRangesImplsRangeSizes(t, allRange, 1);
}
use of com.palantir.atlasdb.keyvalue.api.RangeRequest in project atlasdb by palantir.
the class AbstractTransactionTest method testKeyValueRangesMany3.
@Test
public void testKeyValueRangesMany3() {
putDirect("row1", "col1", "", 0);
putDirect("row2", "col1", "", 0);
putDirect("row2", "col2", "", 0);
RangeRequest allRange = RangeRequest.builder().prefixRange("row1".getBytes()).batchHint(3).build();
for (int i = 0; i < 1000; i++) {
ClosableIterator<RowResult<Value>> range = keyValueService.getRange(TEST_TABLE, allRange, 1);
ImmutableList<RowResult<Value>> list = ImmutableList.copyOf(range);
assertEquals(1, list.size());
}
}
use of com.palantir.atlasdb.keyvalue.api.RangeRequest in project atlasdb by palantir.
the class AbstractTransactionTest method testKeyValueRanges2.
@Test
public void testKeyValueRanges2() {
putDirect("row1", "col1", "", 0);
putDirect("row2", "col1", "", 0);
putDirect("row2", "col2", "", 0);
final RangeRequest allRange = RangeRequest.builder().build();
final RangeRequest oneRange = RangeRequest.builder().startRowInclusive("row2".getBytes()).build();
final RangeRequest allRangeBatch = RangeRequest.builder().batchHint(3).build();
Map<RangeRequest, TokenBackedBasicResultsPage<RowResult<Value>, byte[]>> ranges = keyValueService.getFirstBatchForRanges(TEST_TABLE, ImmutableList.of(allRange, oneRange, allRangeBatch), 1);
assertTrue(ranges.get(allRange).getResults().size() >= 1);
assertEquals(2, ranges.get(allRangeBatch).getResults().size());
assertFalse(ranges.get(allRangeBatch).moreResultsAvailable());
assertEquals(1, ranges.get(oneRange).getResults().size());
}
use of com.palantir.atlasdb.keyvalue.api.RangeRequest in project atlasdb by palantir.
the class AbstractTransactionTest method testKeyValueRangesMany2.
@Test
public void testKeyValueRangesMany2() {
putDirect("row1", "col1", "", 0);
putDirect("row2", "col1", "", 0);
putDirect("row2", "col2", "", 0);
RangeRequest allRange = RangeRequest.builder().batchHint(3).build();
for (int i = 0; i < 1000; i++) {
ClosableIterator<RowResult<Value>> range = keyValueService.getRange(TEST_TABLE, allRange, 1);
ImmutableList<RowResult<Value>> list = ImmutableList.copyOf(range);
assertEquals(2, list.size());
}
}
use of com.palantir.atlasdb.keyvalue.api.RangeRequest in project atlasdb by palantir.
the class AbstractTransactionTest method testRangeAfterTimestampReverse.
@Test
public void testRangeAfterTimestampReverse() {
if (!supportsReverse()) {
return;
}
putDirect("row1", "col2", "", 0);
putDirect("row2", "col2", "", 0);
putDirect("row3", "col2", "", 5);
RangeRequest rangeRequest = RangeRequest.reverseBuilder().batchHint(1).build();
Map<RangeRequest, TokenBackedBasicResultsPage<RowResult<Value>, byte[]>> ranges = keyValueService.getFirstBatchForRanges(TEST_TABLE, Collections.singleton(rangeRequest), 1);
assertEquals(1, ranges.keySet().size());
TokenBackedBasicResultsPage<RowResult<Value>, byte[]> page = ranges.values().iterator().next();
assertTrue(page.moreResultsAvailable());
}
Aggregations