T
- the type of event that is tracked.public interface EvictionPolicy<T,S>
Modifier and Type | Interface and Description |
---|---|
static class |
EvictionPolicy.Action
The action to be taken when
evict(Event) is invoked. |
Modifier and Type | Method and Description |
---|---|
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.
|
EvictionContext |
getContext()
Returns the current context that is part of this eviction policy.
|
S |
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(S 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.
|
void |
track(Event<T> event)
Tracks the event to later decide whether
evict(Event)
should evict it or not. |
EvictionPolicy.Action evict(Event<T> event)
event
- the input eventEvictionPolicy.Action
to be taken
based on the input eventvoid track(Event<T> event)
evict(Event)
should evict it or not.event
- the input event to be trackedEvictionContext getContext()
void setContext(EvictionContext context)
context
- the eviction contextvoid reset()
S getState()
void restoreState(S state)
state
- the state