public Iterator<GeoWaveRow> getRows(final byte[][] dataIds, final short adapterId) { final Map<byte[], byte[]> results = getCurrentSyncCollection().getAll(new HashSet<>(Arrays.asList(dataIds))); return Arrays.stream(dataIds).map( dataId -> DataIndexUtils.deserializeDataIndexRow( dataId, adapterId, results.get(dataId), visibilityEnabled)).iterator(); }
private BatchGetItemResult getResults( final Map<String, KeysAndAttributes> requestItems, final short adapterId, final Map<ByteArray, GeoWaveRow> resultMap) { final BatchGetItemRequest request = new BatchGetItemRequest(requestItems); final BatchGetItemResult result = client.batchGetItem(request); result.getResponses().values().forEach(results -> results.stream().forEach(objMap -> { final byte[] dataId = objMap.get(DynamoDBRow.GW_PARTITION_ID_KEY).getB().array(); final AttributeValue valueAttr = objMap.get(DynamoDBRow.GW_VALUE_KEY); final byte[] value = valueAttr == null ? null : valueAttr.getB().array(); resultMap.put( new ByteArray(dataId), DataIndexUtils.deserializeDataIndexRow(dataId, adapterId, value, false)); })); return result; }
public synchronized CloseableIterator<GeoWaveRow> dataIndexIterator(final byte[][] dataIds) { final RocksDB readDb = getReadDb(); if (readDb == null) { return new CloseableIterator.Empty<>(); } try { final List<byte[]> dataIdsList = Arrays.asList(dataIds); final Map<byte[], byte[]> dataIdxResults = readDb.multiGet(dataIdsList); return new CloseableIterator.Wrapper( dataIdsList.stream().map( dataId -> DataIndexUtils.deserializeDataIndexRow( dataId, adapterId, dataIdxResults.get(dataId), visibilityEnabled)).iterator()); } catch (final RocksDBException e) { LOGGER.error("Unable to get values by data ID", e); } return new CloseableIterator.Empty<>(); } }
public Iterator<GeoWaveRow> getDataIndexResults( final byte[][] rows, final short adapterId, final String... additionalAuthorizations) { Result[] results = null; final byte[] family = StringUtils.stringToBinary(ByteArrayUtils.shortToString(adapterId)); try (final Table table = conn.getTable(getTableName(DataIndexUtils.DATA_ID_INDEX.getName()))) { results = table.get(Arrays.stream(rows).map(r -> { final Get g = new Get(r); g.addFamily(family); if ((additionalAuthorizations != null) && (additionalAuthorizations.length > 0)) { g.setAuthorizations(new Authorizations(additionalAuthorizations)); } return g; }).collect(Collectors.toList())); } catch (final IOException e) { LOGGER.error("Unable to close HBase table", e); } if (results != null) { return Arrays.stream(results).map( r -> DataIndexUtils.deserializeDataIndexRow( r.getRow(), adapterId, r.getValue(family, new byte[0]), false)).iterator(); } return Collections.emptyIterator(); }
resultsMap.put( new ByteArray(d), DataIndexUtils.deserializeDataIndexRow(d, adapterId, v, options.isVisibilityEnabled())); }); return Arrays.stream(dataIds).map(d -> resultsMap.get(new ByteArray(d))).iterator();