Skip to content

Improve "(de)serialization" machinery #1

@fwcd

Description

@fwcd

Note

"Serialization" and "deserialization" as used in phare.serialize refers to conversion of dataclasses from and to JSON-style dicts (the MessagePack encoding is handled separately already). Ideally we would find a better name to avoid confusion here.

The current implementation does not handle deserialization very well yet and just dumps the payload verbatim into the ServerMessage.payload field. We should improve this by checking for known formats and deserializing them (e.g. InputEvent).

The main challenge would be figuring out a way to do this without coupling the serialization machinery (phare.serialize) too much to the protocol itself. In the Rust and Swift implementations of this API we use an enum with associated values (see here and here) to model this, perhaps we could use a Union to emulate this ADT-style approach in Python?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions