public class SharedBufferAccessor<V> extends Object implements AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
advanceTime(long timestamp)
Notifies shared buffer that there will be no events with timestamp <&eq; the given value.
|
void |
close()
Persists the entry in the cache to the underlay state.
|
List<Map<String,List<EventId>>> |
extractPatterns(NodeId nodeId,
DeweyNumber version)
Returns all elements from the previous relation starting at the given entry.
|
void |
lockNode(NodeId node,
DeweyNumber version)
Increases the reference counter for the given entry so that it is not accidentally removed.
|
Map<String,List<V>> |
materializeMatch(Map<String,List<EventId>> match)
Extracts the real event from the sharedBuffer with pre-extracted eventId.
|
NodeId |
put(String stateName,
EventId eventId,
NodeId previousNodeId,
DeweyNumber version)
Stores given value (value + timestamp) under the given state.
|
EventId |
registerEvent(V value,
long timestamp)
Adds another unique event to the shared buffer and assigns a unique id for it.
|
void |
releaseEvent(EventId eventId)
Decreases the reference counter for the given event so that it can be removed once the
reference counter reaches 0.
|
void |
releaseNode(NodeId node,
DeweyNumber version)
Decreases the reference counter for the given entry so that it can be removed once the
reference counter reaches 0.
|
public void advanceTime(long timestamp) throws Exception
timestamp
- watermark, no earlier events will arriveException
- Thrown if the system cannot access the state.public EventId registerEvent(V value, long timestamp) throws Exception
ComputationState
s
NOTE:Should be called only once for each unique event!
value
- event to be registeredException
- Thrown if the system cannot access the state.public NodeId put(String stateName, EventId eventId, @Nullable NodeId previousNodeId, DeweyNumber version)
stateName
- name of the state that the event should be assigned toeventId
- unique id of event assigned by this SharedBufferpreviousNodeId
- id of previous entry (might be null if start of new run)version
- Version of the previous relationpublic List<Map<String,List<EventId>>> extractPatterns(NodeId nodeId, DeweyNumber version)
nodeId
- id of the starting entryversion
- Version of the previous relation which shall be extractedpublic Map<String,List<V>> materializeMatch(Map<String,List<EventId>> match)
match
- the matched event's eventId.public void lockNode(NodeId node, DeweyNumber version)
node
- id of the entryversion
- dewey number of the (potential) edge that locks the given nodepublic void releaseNode(NodeId node, DeweyNumber version) throws Exception
node
- id of the entryversion
- dewey number of the (potential) edge that locked the given nodeException
- Thrown if the system cannot access the state.public void releaseEvent(EventId eventId) throws Exception
eventId
- id of the eventException
- Thrown if the system cannot access the state.public void close() throws Exception
close
in interface AutoCloseable
Exception
- Thrown if the system cannot access the state.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.