Class AbstractTtlDecorator<T>

  • Type Parameters:
    T - Type of originally wrapped object
    Direct Known Subclasses:
    TtlAggregateFunction, TtlReduceFunction

    public abstract class AbstractTtlDecorator<T>
    extends Object
    Base class for TTL logic wrappers.
    • Field Detail

      • original

        protected final T original
        Wrapped original state handler.
      • config

        protected final org.apache.flink.api.common.state.StateTtlConfig config
      • updateTsOnRead

        protected final boolean updateTsOnRead
        Whether to renew expiration timestamp on state read access.
      • returnExpired

        protected final boolean returnExpired
        Whether to renew expiration timestamp on state read access.
      • ttl

        protected final long ttl
        State value time to live in milliseconds.
    • Constructor Detail

      • AbstractTtlDecorator

        protected AbstractTtlDecorator​(T original,
                                       org.apache.flink.api.common.state.StateTtlConfig config,
                                       TtlTimeProvider timeProvider)
    • Method Detail

      • getUnexpired

        public <V> V getUnexpired​(TtlValue<V> ttlValue)
      • expired

        public <V> boolean expired​(TtlValue<V> ttlValue)
      • wrapWithTs

        public <V> TtlValue<V> wrapWithTs​(V value)
      • rewrapWithNewTs

        public <V> TtlValue<V> rewrapWithNewTs​(TtlValue<V> ttlValue)
      • getWithTtlCheckAndUpdate

        public <SE extends Throwable,​CE extends Throwable,​CLE extends Throwable,​V> V getWithTtlCheckAndUpdate​(org.apache.flink.util.function.SupplierWithException<TtlValue<V>,​SE> getter,
                                                                                                                                org.apache.flink.util.function.ThrowingConsumer<TtlValue<V>,​CE> updater,
                                                                                                                                org.apache.flink.util.function.ThrowingRunnable<CLE> stateClear)
                                                                                                                         throws SE extends Throwable,
                                                                                                                                CE extends Throwable,
                                                                                                                                CLE extends Throwable
        Throws:
        SE extends Throwable
      • getWrappedWithTtlCheckAndUpdate

        public <SE extends Throwable,​CE extends Throwable,​CLE extends Throwable,​V> TtlValue<V> getWrappedWithTtlCheckAndUpdate​(org.apache.flink.util.function.SupplierWithException<TtlValue<V>,​SE> getter,
                                                                                                                                                 org.apache.flink.util.function.ThrowingConsumer<TtlValue<V>,​CE> updater,
                                                                                                                                                 org.apache.flink.util.function.ThrowingRunnable<CLE> stateClear)
                                                                                                                                          throws SE extends Throwable,
                                                                                                                                                 CE extends Throwable,
                                                                                                                                                 CLE extends Throwable
        Throws:
        SE extends Throwable
      • getElementWithTtlCheck

        protected <T> T getElementWithTtlCheck​(TtlValue<T> ttlValue)