Class DeltaEvictor<T,​W extends Window>

  • Type Parameters:
    W - The type of Windows on which this Evictor can operate.
    All Implemented Interfaces:
    Serializable, Evictor<T,​W>

    @PublicEvolving
    public class DeltaEvictor<T,​W extends Window>
    extends Object
    implements Evictor<T,​W>
    An Evictor that keeps elements based on a DeltaFunction and a threshold.

    Eviction starts from the first element of the buffer and removes all elements from the buffer which have a higher delta then the threshold.

    See Also:
    Serialized Form
    • Method Detail

      • evictBefore

        public void evictBefore​(Iterable<TimestampedValue<T>> elements,
                                int size,
                                W window,
                                Evictor.EvictorContext ctx)
        Description copied from interface: Evictor
        Optionally evicts elements. Called before windowing function.
        Specified by:
        evictBefore in interface Evictor<T,​W extends Window>
        Parameters:
        elements - The elements currently in the pane.
        size - The current number of elements in the pane.
        window - The Window
        ctx - The context for the Evictor
      • evictAfter

        public void evictAfter​(Iterable<TimestampedValue<T>> elements,
                               int size,
                               W window,
                               Evictor.EvictorContext ctx)
        Description copied from interface: Evictor
        Optionally evicts elements. Called after windowing function.
        Specified by:
        evictAfter in interface Evictor<T,​W extends Window>
        Parameters:
        elements - The elements currently in the pane.
        size - The current number of elements in the pane.
        window - The Window
        ctx - The context for the Evictor
      • of

        public static <T,​W extends WindowDeltaEvictor<T,​W> of​(double threshold,
                                                                            DeltaFunction<T> deltaFunction)
        Creates a DeltaEvictor from the given threshold and DeltaFunction. Eviction is done before the window function.
        Parameters:
        threshold - The threshold
        deltaFunction - The DeltaFunction
      • of

        public static <T,​W extends WindowDeltaEvictor<T,​W> of​(double threshold,
                                                                            DeltaFunction<T> deltaFunction,
                                                                            boolean doEvictAfter)
        Creates a DeltaEvictor from the given threshold, DeltaFunction. Eviction is done before/after the window function based on the value of doEvictAfter.
        Parameters:
        threshold - The threshold
        deltaFunction - The DeltaFunction
        doEvictAfter - Whether eviction should be done after window function