Search in sources :

Example 1 with ATransformingIterator

use of de.invesdwin.util.collections.iterable.ATransformingIterator in project invesdwin-context-persistence by subes.

the class ASegmentedTimeSeriesStorageCache method deleteAll.

public synchronized void deleteAll() {
    final ADelegateRangeTable<String, TimeRange, SegmentStatus> segmentStatusTable = storage.getSegmentStatusTable();
    final List<TimeRange> rangeKeys;
    try (ICloseableIterator<TimeRange> rangeKeysIterator = new ATransformingIterator<RangeTableRow<String, TimeRange, SegmentStatus>, TimeRange>(segmentStatusTable.range(hashKey)) {

        @Override
        protected TimeRange transform(final RangeTableRow<String, TimeRange, SegmentStatus> value) {
            return value.getRangeKey();
        }
    }) {
        rangeKeys = Lists.toListWithoutHasNext(rangeKeysIterator);
    }
    for (int i = 0; i < rangeKeys.size(); i++) {
        final TimeRange rangeKey = rangeKeys.get(i);
        segmentedTable.deleteRange(new SegmentedKey<K>(key, rangeKey));
    }
    segmentStatusTable.deleteRange(hashKey);
    storage.deleteRange_latestValueLookupTable(hashKey);
    storage.deleteRange_nextValueLookupTable(hashKey);
    storage.deleteRange_previousValueLookupTable(hashKey);
    clearCaches();
}
Also used : TimeRange(de.invesdwin.util.time.range.TimeRange) ATransformingIterator(de.invesdwin.util.collections.iterable.ATransformingIterator) RangeTableRow(ezdb.table.RangeTableRow)

Aggregations

ATransformingIterator (de.invesdwin.util.collections.iterable.ATransformingIterator)1 TimeRange (de.invesdwin.util.time.range.TimeRange)1 RangeTableRow (ezdb.table.RangeTableRow)1