Class TimeEvictor<W extends Window>

    • Constructor Detail

      • TimeEvictor

        public TimeEvictor​(long windowSize)
      • TimeEvictor

        public TimeEvictor​(long windowSize,
                           boolean doEvictAfter)
    • Method Detail

      • evictBefore

        public void evictBefore​(Iterable<TimestampedValue<Object>> 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<Object,​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<Object>> 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<Object,​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
      • getWindowSize

        @VisibleForTesting
        public long getWindowSize()
      • of

        @Deprecated
        public static <W extends WindowTimeEvictor<W> of​(Time windowSize)
        Deprecated.
        Creates a TimeEvictor that keeps the given number of elements. Eviction is done before the window function.
        Parameters:
        windowSize - The amount of time for which to keep elements.
      • of

        public static <W extends WindowTimeEvictor<W> of​(Duration windowSize)
        Creates a TimeEvictor that keeps the given number of elements. Eviction is done before the window function.
        Parameters:
        windowSize - The amount of time for which to keep elements.
      • of

        @Deprecated
        public static <W extends WindowTimeEvictor<W> of​(Time windowSize,
                                                           boolean doEvictAfter)
        Deprecated.
        Creates a TimeEvictor that keeps the given number of elements. Eviction is done before/after the window function based on the value of doEvictAfter.
        Parameters:
        windowSize - The amount of time for which to keep elements.
        doEvictAfter - Whether eviction is done after window function.
      • of

        public static <W extends WindowTimeEvictor<W> of​(Duration windowSize,
                                                           boolean doEvictAfter)
        Creates a TimeEvictor that keeps the given number of elements. Eviction is done before/after the window function based on the value of doEvictAfter.
        Parameters:
        windowSize - The amount of time for which to keep elements.
        doEvictAfter - Whether eviction is done after window function.