use of org.locationtech.geowave.core.store.operations.DataIndexReaderParams in project geowave by locationtech.
the class DataIndexUtils method delete.
public static void delete(final DataStoreOperations operations, final PersistentAdapterStore adapterStore, final AdapterIndexMappingStore mappingStore, final InternalAdapterStore internalAdapterStore, final Pair<String[], InternalDataAdapter<?>> fieldSubsets, final Pair<InternalDataAdapter<?>, Aggregation<?, ?, ?>> aggregation, final String[] additionalAuthorizations, final ScanCallback<?, ?> scanCallback, final short adapterId, final byte[] startDataId, final byte[] endDataId) {
// TODO within the datastores delete by range is not supported (the deletion logic expect Data
// IDs to be non-null within reader params and deletions don't have logic for handling ranges
// for now, although less efficient, let's query by prefix and then delete by the returned IDs
final DataIndexReaderParams readerParams = new DataIndexReaderParamsBuilder<>(adapterStore, mappingStore, internalAdapterStore).additionalAuthorizations(additionalAuthorizations).isAuthorizationsLimiting(false).adapterId(adapterId).dataIdsByRange(startDataId, endDataId).fieldSubsets(fieldSubsets).aggregation(aggregation).build();
final List<byte[]> dataIds = new ArrayList<>();
try (RowReader<GeoWaveRow> reader = operations.createReader(readerParams)) {
while (reader.hasNext()) {
dataIds.add(reader.next().getDataId());
}
}
delete(operations, adapterStore, mappingStore, internalAdapterStore, fieldSubsets, aggregation, additionalAuthorizations, scanCallback, adapterId, dataIds.toArray(new byte[dataIds.size()][]));
}
use of org.locationtech.geowave.core.store.operations.DataIndexReaderParams in project geowave by locationtech.
the class DataIndexUtils method delete.
public static void delete(final DataStoreOperations operations, final PersistentAdapterStore adapterStore, final AdapterIndexMappingStore mappingStore, final InternalAdapterStore internalAdapterStore, final Pair<String[], InternalDataAdapter<?>> fieldSubsets, final Pair<InternalDataAdapter<?>, Aggregation<?, ?, ?>> aggregation, final String[] additionalAuthorizations, final ScanCallback scanCallback, final short adapterId, final byte[]... dataIds) {
final DataIndexReaderParams readerParams = new DataIndexReaderParamsBuilder<>(adapterStore, mappingStore, internalAdapterStore).additionalAuthorizations(additionalAuthorizations).isAuthorizationsLimiting(false).adapterId(adapterId).dataIds(dataIds).fieldSubsets(fieldSubsets).aggregation(aggregation).build();
if (scanCallback != null) {
// callback but for now we can explicitly read before deleting)
try (RowReader<GeoWaveRow> rowReader = operations.createReader(readerParams)) {
final NativeEntryIteratorWrapper scanCallBackIterator = new NativeEntryIteratorWrapper(adapterStore, mappingStore, DataIndexUtils.DATA_ID_INDEX, rowReader, null, scanCallback, BaseDataStoreUtils.getFieldBitmask(fieldSubsets, DataIndexUtils.DATA_ID_INDEX), null, !BaseDataStoreUtils.isCommonIndexAggregation(aggregation), null);
// just drain the iterator so the scan callback is properly exercised
scanCallBackIterator.forEachRemaining(it -> {
});
}
}
operations.delete(readerParams);
}
Aggregations