Package org.apache.storm.windowing
Interface EvictionPolicy<T,S>
-
- Type Parameters:
T- the type of event that is tracked.
- All Known Implementing Classes:
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classEvictionPolicy.ActionThe action to be taken whenevict(Event)is invoked.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EvictionPolicy.Actionevict(Event<T> event)Decides if an event should be expired from the window, processed in the current window or kept for later processing.EvictionContextgetContext()Returns the current context that is part of this eviction policy.SgetState()Return runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.voidreset()Resets the eviction policy.voidrestoreState(S state)Restore the eviction policy from the state that was earlier checkpointed by the framework.voidsetContext(EvictionContext context)Sets a context in the eviction policy that can be used while evicting the events.voidtrack(Event<T> event)Tracks the event to later decide whetherevict(Event)should evict it or not.
-
-
-
Method Detail
-
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.- Parameters:
event- the input event- Returns:
- the
EvictionPolicy.Actionto be taken based on the input event
-
track
void track(Event<T> event)
Tracks the event to later decide whetherevict(Event)should evict it or not.- Parameters:
event- the input event to be tracked
-
getContext
EvictionContext getContext()
Returns the current context that is part of this eviction policy.- Returns:
- the eviction context
-
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.- Parameters:
context- 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.- Returns:
- the state
-
restoreState
void restoreState(S state)
Restore the eviction policy from the state that was earlier checkpointed by the framework.- Parameters:
state- the state
-
-