接口 EvictionPolicy<T,S>

类型参数:
T - the type of event that is tracked.
S - the type of state that is used
所有已知实现类:
CountEvictionPolicy, TimeEvictionPolicy, WatermarkCountEvictionPolicy, WatermarkTimeEvictionPolicy

public interface EvictionPolicy<T,S>
Eviction policy tracks events and decides whether an event should be evicted from the window or not.
  • 嵌套类概要

    嵌套类
    修饰符和类型
    接口
    说明
    static enum 
    The action to be taken when evict(Event) is invoked.
  • 方法概要

    修饰符和类型
    方法
    说明
    evict(Event<T> event)
    Decides if an event should be expired from the window, processed in the current window or kept for later processing.
    Returns the current context that is part of this eviction policy.
    Return runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.
    void
    Resets the eviction policy.
    void
    restoreState(S state)
    Restore the eviction policy from the state that was earlier checkpointed by the framework.
    void
    Sets a context in the eviction policy that can be used while evicting the events.
    void
    track(Event<T> event)
    Tracks the event to later decide whether evict(Event) should evict it or not.
  • 方法详细资料

    • evict

      EvictionPolicy.Action evict(Event<T> event)
      Decides if an event should be expired from the window, processed in the current window or kept for later processing.
      参数:
      event - the input event
      返回:
      the EvictionPolicy.Action to be taken based on the input event
    • track

      void track(Event<T> event)
      Tracks the event to later decide whether evict(Event) should evict it or not.
      参数:
      event - the input event to be tracked
    • setContext

      void setContext(EvictionContext context)
      Sets a context in the eviction policy that can be used while evicting the events. E.g. For TimeEvictionPolicy, this could be used to set the reference timestamp.
      参数:
      context - the eviction context
    • getContext

      EvictionContext getContext()
      Returns the current context that is part of this eviction policy.
      返回:
      the eviction context
    • reset

      void reset()
      Resets the eviction policy.
    • getState

      S getState()
      Return runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.
      返回:
      the state
    • restoreState

      void restoreState(S state)
      Restore the eviction policy from the state that was earlier checkpointed by the framework.
      参数:
      state - the state