private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (nodeIdSerializer == null) { // the nested serializers will be null if this was read from a savepoint taken with versions // lower than Flink 1.7; in this case, we explicitly create instances for the nested serializers this.nodeIdSerializer = new NodeId.NodeIdSerializer(); this.deweyNumberSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE; } } }
private void copyStates(DataInputView source, DataOutputView target) throws IOException { int computationStateNo = source.readInt(); target.writeInt(computationStateNo); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); STATE_NAME_SERIALIZER.serialize(state, target); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); NODE_ID_SERIALIZER.serialize(prevState, target); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); VERSION_SERIALIZER.serialize(version, target); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); TIMESTAMP_SERIALIZER.serialize(startTimestamp, target); byte isNull = source.readByte(); target.writeByte(isNull); if (isNull == 1) { EventId startEventId = EVENT_ID_SERIALIZER.deserialize(source); EVENT_ID_SERIALIZER.serialize(startEventId, target); } } }
private void copyStates(DataInputView source, DataOutputView target) throws IOException { int computationStateNo = source.readInt(); target.writeInt(computationStateNo); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); STATE_NAME_SERIALIZER.serialize(state, target); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); NODE_ID_SERIALIZER.serialize(prevState, target); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); VERSION_SERIALIZER.serialize(version, target); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); TIMESTAMP_SERIALIZER.serialize(startTimestamp, target); byte isNull = source.readByte(); target.writeByte(isNull); if (isNull == 1) { EventId startEventId = EVENT_ID_SERIALIZER.deserialize(source); EVENT_ID_SERIALIZER.serialize(startEventId, target); } } }
private PriorityQueue<ComputationState> deserializeComputationStates(DataInputView source) throws IOException { PriorityQueue<ComputationState> computationStates = new PriorityQueue<>(NFAState.COMPUTATION_STATE_COMPARATOR); int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); byte isNull = source.readByte(); EventId startEventId = null; if (isNull == 1) { startEventId = EVENT_ID_SERIALIZER.deserialize(source); } computationStates.add(ComputationState.createState(state, prevState, version, startTimestamp, startEventId)); } return computationStates; }
private PriorityQueue<ComputationState> deserializeComputationStates(DataInputView source) throws IOException { PriorityQueue<ComputationState> computationStates = new PriorityQueue<>(NFAState.COMPUTATION_STATE_COMPARATOR); int computationStateNo = source.readInt(); for (int i = 0; i < computationStateNo; i++) { String state = STATE_NAME_SERIALIZER.deserialize(source); NodeId prevState = NODE_ID_SERIALIZER.deserialize(source); DeweyNumber version = VERSION_SERIALIZER.deserialize(source); long startTimestamp = TIMESTAMP_SERIALIZER.deserialize(source); byte isNull = source.readByte(); EventId startEventId = null; if (isNull == 1) { startEventId = EVENT_ID_SERIALIZER.deserialize(source); } computationStates.add(ComputationState.createState(state, prevState, version, startTimestamp, startEventId)); } return computationStates; }
private void serializeComputationStates(Queue<ComputationState> states, DataOutputView target) throws IOException { target.writeInt(states.size()); for (ComputationState computationState : states) { STATE_NAME_SERIALIZER.serialize(computationState.getCurrentStateName(), target); NODE_ID_SERIALIZER.serialize(computationState.getPreviousBufferEntry(), target); VERSION_SERIALIZER.serialize(computationState.getVersion(), target); TIMESTAMP_SERIALIZER.serialize(computationState.getStartTimestamp(), target); if (computationState.getStartEventID() != null) { target.writeByte(1); EVENT_ID_SERIALIZER.serialize(computationState.getStartEventID(), target); } else { target.writeByte(0); } } }
private void serializeComputationStates(Queue<ComputationState> states, DataOutputView target) throws IOException { target.writeInt(states.size()); for (ComputationState computationState : states) { STATE_NAME_SERIALIZER.serialize(computationState.getCurrentStateName(), target); NODE_ID_SERIALIZER.serialize(computationState.getPreviousBufferEntry(), target); VERSION_SERIALIZER.serialize(computationState.getVersion(), target); TIMESTAMP_SERIALIZER.serialize(computationState.getStartTimestamp(), target); if (computationState.getStartEventID() != null) { target.writeByte(1); EVENT_ID_SERIALIZER.serialize(computationState.getStartEventID(), target); } else { target.writeByte(0); } } }
@Override public NodeId deserialize(NodeId reuse, DataInputView source) throws IOException { return deserialize(source); }
@Override public void serialize(SharedBufferEdge record, DataOutputView target) throws IOException { NodeId.NodeIdSerializer.INSTANCE.serialize(record.target, target); DeweyNumber.DeweyNumberSerializer.INSTANCE.serialize(record.deweyNumber, target); }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { NodeId.NodeIdSerializer.INSTANCE.copy(source, target); DeweyNumber.DeweyNumberSerializer.INSTANCE.copy(source, target); }
@Override public NodeId deserialize(NodeId reuse, DataInputView source) throws IOException { return deserialize(source); }
@Override public NodeId copy(NodeId from, NodeId reuse) { return copy(from); }
@Override public NodeId copy(NodeId from, NodeId reuse) { return copy(from); }
@Override public SharedBufferEdge deserialize(DataInputView source) throws IOException { NodeId target = NodeId.NodeIdSerializer.INSTANCE.deserialize(source); DeweyNumber deweyNumber = DeweyNumber.DeweyNumberSerializer.INSTANCE.deserialize(source); return new SharedBufferEdge(target, deweyNumber); }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { NodeId.NodeIdSerializer.INSTANCE.copy(source, target); DeweyNumber.DeweyNumberSerializer.INSTANCE.copy(source, target); }
@Override public void serialize(SharedBufferEdge record, DataOutputView target) throws IOException { NodeId.NodeIdSerializer.INSTANCE.serialize(record.target, target); DeweyNumber.DeweyNumberSerializer.INSTANCE.serialize(record.deweyNumber, target); }
@Override public SharedBufferEdge deserialize(DataInputView source) throws IOException { NodeId target = NodeId.NodeIdSerializer.INSTANCE.deserialize(source); DeweyNumber deweyNumber = DeweyNumber.DeweyNumberSerializer.INSTANCE.deserialize(source); return new SharedBufferEdge(target, deweyNumber); }
public SharedBuffer(KeyedStateStore stateStore, TypeSerializer<V> valueSerializer) { this.eventsBuffer = stateStore.getMapState( new MapStateDescriptor<>( eventsStateName, EventId.EventIdSerializer.INSTANCE, new Lockable.LockableTypeSerializer<>(valueSerializer))); this.entries = stateStore.getMapState( new MapStateDescriptor<>( entriesStateName, new NodeId.NodeIdSerializer(), new Lockable.LockableTypeSerializer<>(new SharedBufferNode.SharedBufferNodeSerializer()))); this.eventsCount = stateStore.getMapState( new MapStateDescriptor<>( eventsCountStateName, LongSerializer.INSTANCE, IntSerializer.INSTANCE)); }
public SharedBufferEdgeSerializer() { this(new NodeId.NodeIdSerializer(), DeweyNumber.DeweyNumberSerializer.INSTANCE); }
@Override public NodeId deserialize(NodeId reuse, DataInputView source) throws IOException { return deserialize(source); }