Skip to content

Packetized streams

katsuo.stream supports packetized streams with the Packet type that can be used as a stream payload shape.

Semantics

There are multiple ways tokens on a stream can be delimited into packets, using different flags with different semantics.

Last semantics

Last semantics is the most common way to packetize a stream. Last semantics adds a last flag to the payload token that is asserted during the last data transfer of the packet.

First semantics

First semantics adds a first flag to the payload token that is asserted during the first data transfer of the packet.

When packet completion is known (e.g. by the packet size being fixed or by using first and last semantics), reception of a first token in the middle of an incomplete packet can be used to discard partial state and start over.

First and last semantics

First and last semantics combines the behavior of first semantics and last semantics.

End semantics

End semantics adds an end flag to the payload token that is asserted during a separate transfer after the last data transfer of the packet. The data field is not valid during this transfer.