You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ByteParser is useful but isn't as useful as it can be. I suggest splitting it up into more fine grained and specialized parser helper by enforcing splitting up the parser in 3 stages.
Parses only the length bytes, creates a buffer efficiently with as few copies as possible (refferring to the asynchronously available buffer)
final class ManualBuffer {
let buffer: MutableByteBuffer
deinit {
buffer.baseAddress?.deallocate(capacity: buffer.count)
}
}
enum Buffer {
case temporary(ByteBuffer)
case persistent(ManualBuffer)
}
}
ByteParser is useful but isn't as useful as it can be. I suggest splitting it up into more fine grained and specialized parser helper by enforcing splitting up the parser in 3 stages.
Stage 1 - boundaries
Input == ByteBuffer, Output == PacketBuffer
:Parses only the length bytes, creates a buffer efficiently with as few copies as possible (refferring to the asynchronously available buffer)
Stage 2 - Classification
Input == PacketBuffer, Output == SomeSpecificPacket
:Transform the PacketBuffer into a specific packet with more details
In SQL that’s be a “row” packet, “column” packet, query packet
Stage 3 - LazyParsing:
Add an extension to a specific packet type that parses the actual data.
The text was updated successfully, but these errors were encountered: