Skip to content

Conversation

@lachem
Copy link
Collaborator

@lachem lachem commented Dec 11, 2024

  • introduce message hard types in protocol
  • compute 32 bit hashes for each type schema
  • expose generated hashes in dynamic, json and cpp
  • improve formatting of the generated cpp code
  • allow looking up specific dynamic serializer by type
  • add schema hash collision validation

The introduction of hard types for messages in the
generated protocol is dictated by the ease of use.
Attempting to have a message data (type) and
pure message (type_id + proto_id) did not result
in an ergonomic API. Instead message had to be
always provided alongside the type. Messages
inherit from data types as it is much easier to create
and send them this way. Messages remain purely
informational and hold no data on their own outside
of the data inherited from the type they are based on.

The introduction schema hash (TYPE::HASH in C++,
serializer.type_hash() in Python and ["hash"] in json)
is dictated by the need to support type consistency
checks of serialized messages.

Since the extraction of types from protocols the latter
became just logical grouping of types. In fact the name
or id of the protocol is not needed to successfully
serialize / deserialize a message.

@lachem lachem marked this pull request as ready for review December 11, 2024 15:50
@lachem lachem requested a review from DrTon December 11, 2024 15:51
@lachem lachem changed the title Add schema (type) hash generation Add strongly typed messages in protocol Dec 18, 2024
```

## Generate messages
## Generating messages
Copy link
Member

@DrTon DrTon Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generating types and protocols maybe?

@DrTon DrTon merged commit dc94c0d into v1 Dec 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants