Package org.apache.storm.windowing
Class WatermarkCountEvictionPolicy<T>
java.lang.Object
org.apache.storm.windowing.WatermarkCountEvictionPolicy<T>
- Type Parameters:
T
- the type of event tracked by this policy.
- All Implemented Interfaces:
EvictionPolicy<T,
Pair<Long, Long>>
public class WatermarkCountEvictionPolicy<T>
extends Object
implements EvictionPolicy<T,Pair<Long,Long>>
An eviction policy that tracks count based on watermark ts and evicts events up to the watermark based on a threshold count.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.storm.windowing.EvictionPolicy
EvictionPolicy.Action
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDecides 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.getState()
Return runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures.void
reset()
Resets the eviction policy.void
restoreState
(Pair<Long, Long> state) Restore the eviction policy from the state that was earlier checkpointed by the framework.void
setContext
(EvictionContext context) Sets a context in the eviction policy that can be used while evicting the events.toString()
void
Tracks the event to later decide whetherEvictionPolicy.evict(Event)
should evict it or not.
-
Field Details
-
threshold
protected final int threshold -
currentCount
-
-
Constructor Details
-
WatermarkCountEvictionPolicy
public WatermarkCountEvictionPolicy(int count)
-
-
Method Details
-
evict
Description copied from interface:EvictionPolicy
Decides if an event should be expired from the window, processed in the current window or kept for later processing.- Specified by:
evict
in interfaceEvictionPolicy<T,
Pair<Long, Long>> - Parameters:
event
- the input event- Returns:
- the
EvictionPolicy.Action
to be taken based on the input event
-
track
Description copied from interface:EvictionPolicy
Tracks the event to later decide whetherEvictionPolicy.evict(Event)
should evict it or not. -
getContext
Description copied from interface:EvictionPolicy
Returns the current context that is part of this eviction policy.- Specified by:
getContext
in interfaceEvictionPolicy<T,
Pair<Long, Long>> - Returns:
- the eviction context
-
setContext
Description copied from interface:EvictionPolicy
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.- Specified by:
setContext
in interfaceEvictionPolicy<T,
Pair<Long, Long>> - Parameters:
context
- the eviction context
-
reset
public void reset()Description copied from interface:EvictionPolicy
Resets the eviction policy. -
getState
Description copied from interface:EvictionPolicy
Return runtime state to be checkpointed by the framework for restoring the eviction policy in case of failures. -
restoreState
Description copied from interface:EvictionPolicy
Restore the eviction policy from the state that was earlier checkpointed by the framework.- Specified by:
restoreState
in interfaceEvictionPolicy<T,
Pair<Long, Long>> - Parameters:
state
- the state
-
toString
-