use of org.locationtech.geowave.core.store.api.WriteResults in project geowave by locationtech.
the class IndexCompositeWriter method internalWrite.
protected WriteResults internalWrite(final T entry, final Function<Writer<T>, WriteResults> internalWriter) {
final Map<String, List<SinglePartitionInsertionIds>> insertionIdsPerIndex = new HashMap<>();
for (final Writer<T> indexWriter : writers) {
final WriteResults ids = internalWriter.apply(indexWriter);
for (final String indexName : ids.getWrittenIndexNames()) {
List<SinglePartitionInsertionIds> partitionInsertionIds = insertionIdsPerIndex.get(indexName);
if (partitionInsertionIds == null) {
partitionInsertionIds = new ArrayList<>();
insertionIdsPerIndex.put(indexName, partitionInsertionIds);
}
partitionInsertionIds.addAll(ids.getInsertionIdsWritten(indexName).getPartitionKeys());
}
}
return new WriteResults(Maps.transformValues(insertionIdsPerIndex, v -> new InsertionIds(v)));
}
use of org.locationtech.geowave.core.store.api.WriteResults in project geowave by locationtech.
the class BaseDataStoreIngestDriver method write.
@Override
protected void write(final Writer writer, final GeoWaveData<?> geowaveData) {
Object obj = geowaveData.getValue();
if (ingestOptions.getTransform() != null) {
obj = ((Function) ingestOptions.getTransform()).apply(obj);
}
if ((ingestOptions.getFilter() != null) && !((Predicate) ingestOptions.getFilter()).test(geowaveData.getValue())) {
return;
}
final WriteResults results = writer.write(obj);
if (ingestOptions.getCallback() != null) {
((IngestCallback) ingestOptions.getCallback()).dataWritten(results, obj);
}
}
use of org.locationtech.geowave.core.store.api.WriteResults in project geowave by locationtech.
the class IndependentAdapterIndexWriter method internalWrite.
private WriteResults internalWrite(final T entry, final Function<T, WriteResults> internalWriter) {
final Iterator<T> indexedEntries = adapter.convertToIndex(index, entry);
final Map<String, List<SinglePartitionInsertionIds>> insertionIdsPerIndex = new HashMap<>();
while (indexedEntries.hasNext()) {
final WriteResults ids = internalWriter.apply(indexedEntries.next());
for (final String indexName : ids.getWrittenIndexNames()) {
List<SinglePartitionInsertionIds> partitionInsertionIds = insertionIdsPerIndex.get(indexName);
if (partitionInsertionIds == null) {
partitionInsertionIds = new ArrayList<>();
insertionIdsPerIndex.put(indexName, partitionInsertionIds);
}
partitionInsertionIds.addAll(ids.getInsertionIdsWritten(indexName).getPartitionKeys());
}
}
return new WriteResults(Maps.transformValues(insertionIdsPerIndex, v -> new InsertionIds(v)));
}
Aggregations