Search in sources :

Example 1 with SpillableStateStore

use of org.apache.apex.malhar.lib.state.spillable.SpillableStateStore in project apex-malhar by apache.

the class SpillableWindowedKeyedStorage method purge.

@Override
public void purge(long horizonMillis) {
    SpillableStateStore store = scc.getStore();
    if (store instanceof ManagedTimeUnifiedStateImpl) {
        ManagedTimeUnifiedStateImpl timeState = (ManagedTimeUnifiedStateImpl) store;
        long purgeTimeBucket = horizonMillis - timeState.getTimeBucketAssigner().getBucketSpan().getMillis();
        LOG.debug("Purging state less than equal to {}", purgeTimeBucket);
        timeState.purgeTimeBucketsLessThanEqualTo(purgeTimeBucket);
    }
}
Also used : ManagedTimeUnifiedStateImpl(org.apache.apex.malhar.lib.state.managed.ManagedTimeUnifiedStateImpl) SpillableStateStore(org.apache.apex.malhar.lib.state.spillable.SpillableStateStore)

Example 2 with SpillableStateStore

use of org.apache.apex.malhar.lib.state.spillable.SpillableStateStore in project apex-malhar by apache.

the class AbstractWindowedOperatorBenchmarkApp method createWindowedOperator.

protected O createWindowedOperator(Configuration conf) {
    SpillableStateStore store = createStore(conf);
    try {
        O windowedOperator = this.windowedOperatorClass.newInstance();
        SpillableComplexComponentImpl sccImpl = new SpillableComplexComponentImpl(store);
        windowedOperator.addComponent("SpillableComplexComponent", sccImpl);
        windowedOperator.setDataStorage(createDataStorage(sccImpl));
        windowedOperator.setRetractionStorage(createRetractionStorage(sccImpl));
        windowedOperator.setWindowStateStorage(new InMemoryWindowedStorage());
        setUpdatedKeyStorage(windowedOperator, conf, sccImpl);
        windowedOperator.setAccumulation(createAccumulation());
        windowedOperator.setAllowedLateness(Duration.millis(ALLOWED_LATENESS));
        windowedOperator.setWindowOption(new WindowOption.TimeWindows(Duration.standardMinutes(1)));
        // accumulating mode
        windowedOperator.setTriggerOption(TriggerOption.AtWatermark().withEarlyFiringsAtEvery(Duration.standardSeconds(1)).accumulatingFiredPanes().firingOnlyUpdatedPanes());
        windowedOperator.setFixedWatermark(30000);
        return windowedOperator;
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : WindowOption(org.apache.apex.malhar.lib.window.WindowOption) InMemoryWindowedStorage(org.apache.apex.malhar.lib.window.impl.InMemoryWindowedStorage) ManagedTimeUnifiedStateSpillableStateStore(org.apache.apex.malhar.lib.state.spillable.managed.ManagedTimeUnifiedStateSpillableStateStore) SpillableStateStore(org.apache.apex.malhar.lib.state.spillable.SpillableStateStore) IOException(java.io.IOException) SpillableComplexComponentImpl(org.apache.apex.malhar.lib.state.spillable.SpillableComplexComponentImpl)

Example 3 with SpillableStateStore

use of org.apache.apex.malhar.lib.state.spillable.SpillableStateStore in project apex-malhar by apache.

the class SpillableWindowedPlainStorage method purge.

@Override
public void purge(long horizonMillis) {
    SpillableStateStore store = scc.getStore();
    if (store instanceof ManagedTimeUnifiedStateImpl) {
        ManagedTimeUnifiedStateImpl timeState = (ManagedTimeUnifiedStateImpl) store;
        long purgeTimeBucket = horizonMillis - timeState.getTimeBucketAssigner().getBucketSpan().getMillis();
        LOG.debug("Purging state less than equal to {}", purgeTimeBucket);
        timeState.purgeTimeBucketsLessThanEqualTo(purgeTimeBucket);
    }
}
Also used : ManagedTimeUnifiedStateImpl(org.apache.apex.malhar.lib.state.managed.ManagedTimeUnifiedStateImpl) SpillableStateStore(org.apache.apex.malhar.lib.state.spillable.SpillableStateStore)

Aggregations

SpillableStateStore (org.apache.apex.malhar.lib.state.spillable.SpillableStateStore)3 ManagedTimeUnifiedStateImpl (org.apache.apex.malhar.lib.state.managed.ManagedTimeUnifiedStateImpl)2 IOException (java.io.IOException)1 SpillableComplexComponentImpl (org.apache.apex.malhar.lib.state.spillable.SpillableComplexComponentImpl)1 ManagedTimeUnifiedStateSpillableStateStore (org.apache.apex.malhar.lib.state.spillable.managed.ManagedTimeUnifiedStateSpillableStateStore)1 WindowOption (org.apache.apex.malhar.lib.window.WindowOption)1 InMemoryWindowedStorage (org.apache.apex.malhar.lib.window.impl.InMemoryWindowedStorage)1