Class SharedBufferAccessor<V>
java.lang.Object
org.apache.flink.cep.nfa.sharedbuffer.SharedBufferAccessor<V>
- All Implemented Interfaces:
AutoCloseable
Accessor to SharedBuffer that allows operations on the underlying structures in batches.
Operations are persisted only after closing the Accessor.
-
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceTime(long timestamp) Notifies shared buffer that there will be no events with timestamp <&eq; the given value.voidclose()Persists the entry in the cache to the underlay state.extractPatterns(NodeId nodeId, DeweyNumber version) Returns all elements from the previous relation starting at the given entry.voidlockNode(NodeId node, DeweyNumber version) Increases the reference counter for the given entry so that it is not accidentally removed.materializeMatch(Map<String, List<EventId>> match) Extracts the real event from the sharedBuffer with pre-extracted eventId.put(String stateName, EventId eventId, NodeId previousNodeId, DeweyNumber version) Stores given value (value + timestamp) under the given state.registerEvent(V value, long timestamp) Adds another unique event to the shared buffer and assigns a unique id for it.voidreleaseEvent(EventId eventId) Decreases the reference counter for the given event so that it can be removed once the reference counter reaches 0.voidreleaseNode(NodeId node, DeweyNumber version) Decreases the reference counter for the given entry so that it can be removed once the reference counter reaches 0.
-
Method Details
-
advanceTime
Notifies shared buffer that there will be no events with timestamp <&eq; the given value. It allows to clear internal counters for number of events seen so far per timestamp.- Parameters:
timestamp- watermark, no earlier events will arrive- Throws:
Exception- Thrown if the system cannot access the state.
-
registerEvent
Adds another unique event to the shared buffer and assigns a unique id for it. It automatically creates a lock on this event, so it won't be removed during processing of that event. Therefore the lock should be removed after processing allComputationStatesNOTE:Should be called only once for each unique event!
- Parameters:
value- event to be registered- Returns:
- unique id of that event that should be used when putting entries to the buffer.
- Throws:
Exception- Thrown if the system cannot access the state.
-
materializeMatch
Extracts the real event from the sharedBuffer with pre-extracted eventId.- Parameters:
match- the matched event's eventId.- Returns:
- the event associated with the eventId.
-
close
Persists the entry in the cache to the underlay state.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- Thrown if the system cannot access the state.
-