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

Implement an Actor for Serialization/Deserialization #30

Open
vonjackets opened this issue Jan 15, 2025 · 1 comment
Open

Implement an Actor for Serialization/Deserialization #30

vonjackets opened this issue Jan 15, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vonjackets
Copy link
Collaborator

A dedicated actor that utilizes protocol buffers should be considered to streamline speed and different methods of serialization and deserialization. This actor would be responsible for encoding messages some format before transmission and decoding received messages back into usable Rust data structures.
Given their stability and popularity, the following alternatives to serde should be considered

Acceptance Criteria

  1. Determine what methods of serailization we want to support
  2. Using Ractor, create an actor that:
    • Accepts messages to (de)serialize
    • Accepts some sort of configuration to determine what method/library to process the message with
    • Either returns processed messages or forwards them to their intended destination
  3. Ensure the actor handles errors gracefully, such as invalid or malformed data.
  4. Integrate the actor with existing client and server actors to replace the current serialization logic.
  5. Add tests to validate:
    • Correct serialization of messages.
    • Accurate deserialization of binary data.
    • Handling of edge cases like invalid or incomplete data.

Implementation Steps

  1. Set Up Schemas

    • Ensure schemas are defined for all relevant data types.
  2. Actor Implementation

    • Use the ractor crate to create an actor by implementing the Actor trait for some struct
    • Implement methods for serialization and deserialization using one or multiple of the aforementioned libraries.
    • Handle errors
  3. Integration

    • Modify observer and consumer actors to delegate serialization and deserialization tasks to the new actor.
    • Ensure the actor is reusable across multiple services.
  4. Testing

    • Write tests for serialization and deserialization functionality.
    • Update client integration tests to verify compatibility with other actors.

Priority

Low: While not urgent, it is a goal of this project to be highly extensible. Supporting various methods of serialization is crucial for and scalability.

@vonjackets vonjackets added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jan 15, 2025
@vonjackets vonjackets self-assigned this Jan 15, 2025
@vonjackets
Copy link
Collaborator Author

There's a concern around what kind of messages the actor should take.
Ideally, it can take it's own "Message" type, Some SerailizerMessage where it either serailizes, or deserializes. If we're giving to something to serialize, we should pass it some kind of header value to signal which library/method of serialization it should use, but always return some byte array for convenience of the tcp client. Deserialization should always return our expected datatypes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant