Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup message handling code #136

Merged
merged 4 commits into from
Apr 5, 2024
Merged

Cleanup message handling code #136

merged 4 commits into from
Apr 5, 2024

Conversation

Maelkum
Copy link
Collaborator

@Maelkum Maelkum commented Apr 1, 2024

This code makes a number of changes to the message types and message handling code.

  • messages no longer have an explicit Type field that can be set - having this and having to set it manually is prone to error (someone might use a certain model and inadvertently set the wrong message type/ID). Now this is done automagically on JSON marshalling
  • messages no longer have an explicit From field telling us who sent the message - this is handled by the node
  • invalid/unused message types are removed
  • we use generics (!) to simplify message decoding, and
  • message processing functions now receive actual types they need and not an obscure byte slice they need to manually unmarshal
  • some verbosity added by defining custom marshallers but wanted to keep backwards compatibility for the moment and have the message data and message type field as top-level fields; worth it for less clutter in node package IMO
  • added differentiation between published messages and those we receive via direct communication; added some validation there - we don't allow just any message to be published as it could lead to issues (e.g. random worker publishes MessageExecute or MessageDisbandCluster)
  • fix handling of workspace/peer db/function db flags - config/default values are now handled correctly

@Maelkum Maelkum self-assigned this Apr 1, 2024
@dmikey dmikey merged commit 60a343d into main Apr 5, 2024
2 checks passed
@dmikey dmikey deleted the simplify-messages branch April 5, 2024 15:59
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.

2 participants