monomux icon indicating copy to clipboard operation
monomux copied to clipboard

Generate the serialisation logic in the messaging layer with tooling instead of the custom case-by-case logic

Open whisperity opened this issue 1 year ago • 0 comments

Currently, all of the serialisation logic for the control message primitives are all built on top of hand-crafted code:

https://github.com/whisperity/monomux/blob/6707ba07fb82de2acbfb25548a13e4d1a4008f5c/src/control/Message.cpp#L224-L340

While arguably this is the only part of the project that's actually tested, the logic behind the communication system follows a clear pattern, and there are not many data types that are generally transmitted (things are either strings, numbers, tuples, or an array of these...).

This means that the communication layer, the full serialisation logic, and perhaps even the automated tests for it (!) could be generated automatically from a sufficiently concise DSL. We should steer clear of heavyweight communication protocol libraries (such as Apache Thrift) or DSL parsers that depend on compiler-grade tooling (such as ODB implemented as a custom GCC frontend action) as such tools might make our compilation process too complex.

While this could be implemented as a fully backwards-compatible change, it might be worthwhile to do this together with (or as a precondition of) #17 and several other planned communication layer changes (e.g., #14). We might realise during making this that a different format is more suitable for comfortable automatically generated serialisation, and it would be great only to break ABI once if we can afford it.

whisperity avatar Jan 11 '23 22:01 whisperity