org.apache.flink.cep.nfa.sharedbuffer.NodeId Java Examples
The following examples show how to use
org.apache.flink.cep.nfa.sharedbuffer.NodeId.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComputationState.java From flink with Apache License 2.0 | 5 votes |
public static ComputationState createState( final String currentState, final NodeId previousEntry, final DeweyNumber version, final long startTimestamp, final EventId startEventID) { return new ComputationState(currentState, previousEntry, version, startEventID, startTimestamp); }
Example #2
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private void copySingleComputationState(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); NodeId prevState = nodeIdSerializer.deserialize(source); nodeIdSerializer.serialize(prevState, target); DeweyNumber version = versionSerializer.deserialize(source); versionSerializer.serialize(version, target); long startTimestamp = source.readLong(); target.writeLong(startTimestamp); copyStartEvent(source, target); }
Example #3
Source File: NFAStateSerializerSnapshot.java From flink with Apache License 2.0 | 5 votes |
@Override protected TypeSerializer<?>[] getNestedSerializers(NFAStateSerializer outerSerializer) { TypeSerializer<DeweyNumber> versionSerializer = outerSerializer.getVersionSerializer(); TypeSerializer<NodeId> nodeIdSerializer = outerSerializer.getNodeIdSerializer(); TypeSerializer<EventId> eventIdSerializer = outerSerializer.getEventIdSerializer(); return new TypeSerializer[]{versionSerializer, nodeIdSerializer, eventIdSerializer}; }
Example #4
Source File: NFAStateSerializerSnapshot.java From flink with Apache License 2.0 | 5 votes |
@Override protected NFAStateSerializer createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers) { @SuppressWarnings("unchecked") TypeSerializer<DeweyNumber> versionSerializer = (TypeSerializer<DeweyNumber>) nestedSerializers[0]; @SuppressWarnings("unchecked") TypeSerializer<NodeId> nodeIdSerializer = (TypeSerializer<NodeId>) nestedSerializers[1]; @SuppressWarnings("unchecked") TypeSerializer<EventId> eventIdSerializer = (TypeSerializer<EventId>) nestedSerializers[2]; return new NFAStateSerializer(versionSerializer, nodeIdSerializer, eventIdSerializer); }
Example #5
Source File: MigrationUtils.java From flink with Apache License 2.0 | 5 votes |
static <T> Queue<ComputationState> deserializeComputationStates( org.apache.flink.cep.nfa.SharedBuffer<T> sharedBuffer, TypeSerializer<T> eventSerializer, DataInputView source) throws IOException { Queue<ComputationState> computationStates = new LinkedList<>(); StringSerializer stateNameSerializer = StringSerializer.INSTANCE; LongSerializer timestampSerializer = LongSerializer.INSTANCE; DeweyNumber.DeweyNumberSerializer versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = stateNameSerializer.deserialize(source); String prevState = stateNameSerializer.deserialize(source); long timestamp = timestampSerializer.deserialize(source); DeweyNumber version = versionSerializer.deserialize(source); long startTimestamp = timestampSerializer.deserialize(source); int counter = source.readInt(); T event = null; if (source.readBoolean()) { event = eventSerializer.deserialize(source); } NodeId nodeId; EventId startEventId; if (prevState != null) { nodeId = sharedBuffer.getNodeId(prevState, timestamp, counter, event); startEventId = sharedBuffer.getStartEventId(version.getRun()); } else { nodeId = null; startEventId = null; } computationStates.add(ComputationState.createState(state, nodeId, version, startTimestamp, startEventId)); } return computationStates; }
Example #6
Source File: SharedBuffer.java From flink with Apache License 2.0 | 5 votes |
public SharedBuffer( Map<EventId, Lockable<V>> eventsBuffer, Map<NodeId, Lockable<SharedBufferNode>> pages, Map<Tuple2<String, ValueTimeWrapper<V>>, NodeId> mappingContext, Map<Integer, EventId> starters) { this.eventsBuffer = eventsBuffer; this.pages = pages; this.mappingContext = mappingContext; this.starters = starters; }
Example #7
Source File: NFA.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void addComputationState( SharedBufferAccessor<T> sharedBufferAccessor, List<ComputationState> computationStates, State<T> currentState, NodeId previousEntry, DeweyNumber version, long startTimestamp, EventId startEventId) throws Exception { ComputationState computationState = ComputationState.createState( currentState.getName(), previousEntry, version, startTimestamp, startEventId); computationStates.add(computationState); sharedBufferAccessor.lockNode(previousEntry); }
Example #8
Source File: ComputationState.java From flink with Apache License 2.0 | 5 votes |
private ComputationState( final String currentState, @Nullable final NodeId previousBufferEntry, final DeweyNumber version, @Nullable final EventId startEventID, final long startTimestamp) { this.currentStateName = currentState; this.version = version; this.startTimestamp = startTimestamp; this.previousBufferEntry = previousBufferEntry; this.startEventID = startEventID; }
Example #9
Source File: ComputationState.java From flink with Apache License 2.0 | 5 votes |
public static ComputationState createState( final String currentState, final NodeId previousEntry, final DeweyNumber version, final long startTimestamp, final EventId startEventID) { return new ComputationState(currentState, previousEntry, version, startEventID, startTimestamp); }
Example #10
Source File: NFA.java From flink with Apache License 2.0 | 5 votes |
private void addComputationState( SharedBufferAccessor<T> sharedBufferAccessor, List<ComputationState> computationStates, State<T> currentState, NodeId previousEntry, DeweyNumber version, long startTimestamp, EventId startEventId) throws Exception { ComputationState computationState = ComputationState.createState( currentState.getName(), previousEntry, version, startTimestamp, startEventId); computationStates.add(computationState); sharedBufferAccessor.lockNode(previousEntry); }
Example #11
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // the nested serializer will be null if this was read from a savepoint taken with versions // lower than Flink 1.7; in this case, we explicitly create instance for the nested serializer. if (versionSerializer == null || nodeIdSerializer == null || eventIdSerializer == null) { this.versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; this.eventIdSerializer = EventId.EventIdSerializer.INSTANCE; this.nodeIdSerializer = new NodeId.NodeIdSerializer(); } }
Example #12
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
NFAStateSerializer( final TypeSerializer<DeweyNumber> versionSerializer, final TypeSerializer<NodeId> nodeIdSerializer, final TypeSerializer<EventId> eventIdSerializer) { this.versionSerializer = checkNotNull(versionSerializer); this.nodeIdSerializer = checkNotNull(nodeIdSerializer); this.eventIdSerializer = checkNotNull(eventIdSerializer); }
Example #13
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private ComputationState deserializeSingleComputationState(DataInputView source) throws IOException { String stateName = StringValue.readString(source); NodeId prevState = nodeIdSerializer.deserialize(source); DeweyNumber version = versionSerializer.deserialize(source); long startTimestamp = source.readLong(); EventId startEventId = deserializeStartEvent(source); return ComputationState.createState(stateName, prevState, version, startTimestamp, startEventId); }
Example #14
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private void copySingleComputationState(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); NodeId prevState = nodeIdSerializer.deserialize(source); nodeIdSerializer.serialize(prevState, target); DeweyNumber version = versionSerializer.deserialize(source); versionSerializer.serialize(version, target); long startTimestamp = source.readLong(); target.writeLong(startTimestamp); copyStartEvent(source, target); }
Example #15
Source File: NFAStateSerializer.java From flink with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // the nested serializer will be null if this was read from a savepoint taken with versions // lower than Flink 1.7; in this case, we explicitly create instance for the nested serializer. if (versionSerializer == null || nodeIdSerializer == null || eventIdSerializer == null) { this.versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; this.eventIdSerializer = EventId.EventIdSerializer.INSTANCE; this.nodeIdSerializer = new NodeId.NodeIdSerializer(); } }
Example #16
Source File: NFAStateSerializerSnapshot.java From flink with Apache License 2.0 | 5 votes |
@Override protected TypeSerializer<?>[] getNestedSerializers(NFAStateSerializer outerSerializer) { TypeSerializer<DeweyNumber> versionSerializer = outerSerializer.getVersionSerializer(); TypeSerializer<NodeId> nodeIdSerializer = outerSerializer.getNodeIdSerializer(); TypeSerializer<EventId> eventIdSerializer = outerSerializer.getEventIdSerializer(); return new TypeSerializer[]{versionSerializer, nodeIdSerializer, eventIdSerializer}; }
Example #17
Source File: NFAStateSerializerSnapshot.java From flink with Apache License 2.0 | 5 votes |
@Override protected NFAStateSerializer createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers) { @SuppressWarnings("unchecked") TypeSerializer<DeweyNumber> versionSerializer = (TypeSerializer<DeweyNumber>) nestedSerializers[0]; @SuppressWarnings("unchecked") TypeSerializer<NodeId> nodeIdSerializer = (TypeSerializer<NodeId>) nestedSerializers[1]; @SuppressWarnings("unchecked") TypeSerializer<EventId> eventIdSerializer = (TypeSerializer<EventId>) nestedSerializers[2]; return new NFAStateSerializer(versionSerializer, nodeIdSerializer, eventIdSerializer); }
Example #18
Source File: MigrationUtils.java From flink with Apache License 2.0 | 5 votes |
static <T> Queue<ComputationState> deserializeComputationStates( org.apache.flink.cep.nfa.SharedBuffer<T> sharedBuffer, TypeSerializer<T> eventSerializer, DataInputView source) throws IOException { Queue<ComputationState> computationStates = new LinkedList<>(); StringSerializer stateNameSerializer = StringSerializer.INSTANCE; LongSerializer timestampSerializer = LongSerializer.INSTANCE; DeweyNumber.DeweyNumberSerializer versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = stateNameSerializer.deserialize(source); String prevState = stateNameSerializer.deserialize(source); long timestamp = timestampSerializer.deserialize(source); DeweyNumber version = versionSerializer.deserialize(source); long startTimestamp = timestampSerializer.deserialize(source); int counter = source.readInt(); T event = null; if (source.readBoolean()) { event = eventSerializer.deserialize(source); } NodeId nodeId; EventId startEventId; if (prevState != null) { nodeId = sharedBuffer.getNodeId(prevState, timestamp, counter, event); startEventId = sharedBuffer.getStartEventId(version.getRun()); } else { nodeId = null; startEventId = null; } computationStates.add(ComputationState.createState(state, nodeId, version, startTimestamp, startEventId)); } return computationStates; }
Example #19
Source File: ComputationState.java From flink with Apache License 2.0 | 5 votes |
private ComputationState( final String currentState, @Nullable final NodeId previousBufferEntry, final DeweyNumber version, @Nullable final EventId startEventID, final long startTimestamp) { this.currentStateName = currentState; this.version = version; this.startTimestamp = startTimestamp; this.previousBufferEntry = previousBufferEntry; this.startEventID = startEventID; }
Example #20
Source File: SharedBuffer.java From flink with Apache License 2.0 | 5 votes |
public SharedBuffer( Map<EventId, Lockable<V>> eventsBuffer, Map<NodeId, Lockable<SharedBufferNode>> pages, Map<Tuple2<String, ValueTimeWrapper<V>>, NodeId> mappingContext, Map<Integer, EventId> starters) { this.eventsBuffer = eventsBuffer; this.pages = pages; this.mappingContext = mappingContext; this.starters = starters; }
Example #21
Source File: SharedBuffer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public SharedBuffer( Map<EventId, Lockable<V>> eventsBuffer, Map<NodeId, Lockable<SharedBufferNode>> pages, Map<Tuple2<String, ValueTimeWrapper<V>>, NodeId> mappingContext, Map<Integer, EventId> starters) { this.eventsBuffer = eventsBuffer; this.pages = pages; this.mappingContext = mappingContext; this.starters = starters; }
Example #22
Source File: NFASerializerUpgradeTest.java From flink with Apache License 2.0 | 5 votes |
@Override public Matcher<SharedBufferNode> testDataMatcher() { SharedBufferNode result = new SharedBufferNode(); result.addEdge(new SharedBufferEdge( new NodeId(new EventId(42, 42L), "page"), new DeweyNumber(42))); return is(result); }
Example #23
Source File: NFAStateSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
NFAStateSerializer( final TypeSerializer<DeweyNumber> versionSerializer, final TypeSerializer<NodeId> nodeIdSerializer, final TypeSerializer<EventId> eventIdSerializer) { this.versionSerializer = checkNotNull(versionSerializer); this.nodeIdSerializer = checkNotNull(nodeIdSerializer); this.eventIdSerializer = checkNotNull(eventIdSerializer); }
Example #24
Source File: NFASerializerUpgradeTest.java From flink with Apache License 2.0 | 5 votes |
@Override public SharedBufferNode createTestData() { SharedBufferNode result = new SharedBufferNode(); result.addEdge(new SharedBufferEdge( new NodeId(new EventId(42, 42L), "page"), new DeweyNumber(42))); return result; }
Example #25
Source File: NFAStateSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private ComputationState deserializeSingleComputationState(DataInputView source) throws IOException { String stateName = StringValue.readString(source); NodeId prevState = nodeIdSerializer.deserialize(source); DeweyNumber version = versionSerializer.deserialize(source); long startTimestamp = source.readLong(); EventId startEventId = deserializeStartEvent(source); return ComputationState.createState(stateName, prevState, version, startTimestamp, startEventId); }
Example #26
Source File: NFAStateSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void copySingleComputationState(DataInputView source, DataOutputView target) throws IOException { StringValue.copyString(source, target); NodeId prevState = nodeIdSerializer.deserialize(source); nodeIdSerializer.serialize(prevState, target); DeweyNumber version = versionSerializer.deserialize(source); versionSerializer.serialize(version, target); long startTimestamp = source.readLong(); target.writeLong(startTimestamp); copyStartEvent(source, target); }
Example #27
Source File: NFAStateSerializer.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // the nested serializer will be null if this was read from a savepoint taken with versions // lower than Flink 1.7; in this case, we explicitly create instance for the nested serializer. if (versionSerializer == null || nodeIdSerializer == null || eventIdSerializer == null) { this.versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; this.eventIdSerializer = EventId.EventIdSerializer.INSTANCE; this.nodeIdSerializer = new NodeId.NodeIdSerializer(); } }
Example #28
Source File: NFAStateSerializerSnapshot.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected TypeSerializer<?>[] getNestedSerializers(NFAStateSerializer outerSerializer) { TypeSerializer<DeweyNumber> versionSerializer = outerSerializer.getVersionSerializer(); TypeSerializer<NodeId> nodeIdSerializer = outerSerializer.getNodeIdSerializer(); TypeSerializer<EventId> eventIdSerializer = outerSerializer.getEventIdSerializer(); return new TypeSerializer[]{versionSerializer, nodeIdSerializer, eventIdSerializer}; }
Example #29
Source File: NFAStateSerializerSnapshot.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected NFAStateSerializer createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers) { @SuppressWarnings("unchecked") TypeSerializer<DeweyNumber> versionSerializer = (TypeSerializer<DeweyNumber>) nestedSerializers[0]; @SuppressWarnings("unchecked") TypeSerializer<NodeId> nodeIdSerializer = (TypeSerializer<NodeId>) nestedSerializers[1]; @SuppressWarnings("unchecked") TypeSerializer<EventId> eventIdSerializer = (TypeSerializer<EventId>) nestedSerializers[2]; return new NFAStateSerializer(versionSerializer, nodeIdSerializer, eventIdSerializer); }
Example #30
Source File: MigrationUtils.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
static <T> Queue<ComputationState> deserializeComputationStates( org.apache.flink.cep.nfa.SharedBuffer<T> sharedBuffer, TypeSerializer<T> eventSerializer, DataInputView source) throws IOException { Queue<ComputationState> computationStates = new LinkedList<>(); StringSerializer stateNameSerializer = StringSerializer.INSTANCE; LongSerializer timestampSerializer = LongSerializer.INSTANCE; DeweyNumber.DeweyNumberSerializer versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = stateNameSerializer.deserialize(source); String prevState = stateNameSerializer.deserialize(source); long timestamp = timestampSerializer.deserialize(source); DeweyNumber version = versionSerializer.deserialize(source); long startTimestamp = timestampSerializer.deserialize(source); int counter = source.readInt(); T event = null; if (source.readBoolean()) { event = eventSerializer.deserialize(source); } NodeId nodeId; EventId startEventId; if (prevState != null) { nodeId = sharedBuffer.getNodeId(prevState, timestamp, counter, event); startEventId = sharedBuffer.getStartEventId(version.getRun()); } else { nodeId = null; startEventId = null; } computationStates.add(ComputationState.createState(state, nodeId, version, startTimestamp, startEventId)); } return computationStates; }