Search in sources :

Example 11 with BatchColumnRangeSelection

use of com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection in project atlasdb by palantir.

the class InMemoryKeyValueService method getRowsColumnRange.

@Override
public Map<byte[], RowColumnRangeIterator> getRowsColumnRange(TableReference tableRef, Iterable<byte[]> rows, BatchColumnRangeSelection batchColumnRangeSelection, long timestamp) {
    Map<byte[], RowColumnRangeIterator> result = Maps.newHashMap();
    ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableRef).entries;
    ColumnRangeSelection columnRangeSelection = new ColumnRangeSelection(batchColumnRangeSelection.getStartCol(), batchColumnRangeSelection.getEndCol());
    for (byte[] row : rows) {
        result.put(row, getColumnRangeForSingleRow(table, row, columnRangeSelection, timestamp));
    }
    return result;
}
Also used : RowColumnRangeIterator(com.palantir.atlasdb.keyvalue.api.RowColumnRangeIterator) BatchColumnRangeSelection(com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection) ColumnRangeSelection(com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection)

Example 12 with BatchColumnRangeSelection

use of com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection in project atlasdb by palantir.

the class OneNodeDownGetTest method canGetRowsColumnRange.

@Test
public void canGetRowsColumnRange() {
    BatchColumnRangeSelection rangeSelection = BatchColumnRangeSelection.create(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY, 1);
    Map<byte[], RowColumnRangeIterator> rowsColumnRange = OneNodeDownTestSuite.kvs.getRowsColumnRange(OneNodeDownTestSuite.TEST_TABLE, ImmutableList.of(OneNodeDownTestSuite.FIRST_ROW), rangeSelection, Long.MAX_VALUE);
    assertEquals(1, rowsColumnRange.size());
    byte[] rowName = rowsColumnRange.entrySet().iterator().next().getKey();
    assertTrue(Arrays.equals(OneNodeDownTestSuite.FIRST_ROW, rowName));
    RowColumnRangeIterator it = rowsColumnRange.get(rowName);
    assertThat(it).containsExactlyElementsOf(expectedRow.entrySet());
}
Also used : BatchColumnRangeSelection(com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection) RowColumnRangeIterator(com.palantir.atlasdb.keyvalue.api.RowColumnRangeIterator) Test(org.junit.Test)

Aggregations

BatchColumnRangeSelection (com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection)12 RowColumnRangeIterator (com.palantir.atlasdb.keyvalue.api.RowColumnRangeIterator)9 Cell (com.palantir.atlasdb.keyvalue.api.Cell)6 Map (java.util.Map)6 Entry (java.util.Map.Entry)6 ImmutableMap (com.google.common.collect.ImmutableMap)5 SortedMap (java.util.SortedMap)5 Value (com.palantir.atlasdb.keyvalue.api.Value)4 LinkedHashMap (java.util.LinkedHashMap)4 ImmutableList (com.google.common.collect.ImmutableList)3 LocalRowColumnRangeIterator (com.palantir.atlasdb.keyvalue.impl.LocalRowColumnRangeIterator)3 HashMap (java.util.HashMap)3 NavigableMap (java.util.NavigableMap)3 AbstractIterator (com.google.common.collect.AbstractIterator)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 ConcurrentNavigableMap (java.util.concurrent.ConcurrentNavigableMap)2 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)2 Test (org.junit.Test)2