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

Use strings for topics #219

Conversation

richardhuaaa
Copy link
Contributor

@richardhuaaa richardhuaaa commented Oct 9, 2024

Using PR to discuss: use string instead of bytes for topics. Batched with previous PR as both changes are disruptive on server/client and can be handled together.

Pros:

  • Easier to debug
  • Topics can be prefixed with human-readable labels (as opposed to reserved bytes)

Cons:

  • Larger topic sizes

Copy link
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @richardhuaaa and the rest of your teammates on Graphite Graphite

@richardhuaaa richardhuaaa marked this pull request as ready for review October 9, 2024 00:55
@richardhuaaa richardhuaaa requested a review from a team as a code owner October 9, 2024 00:55
@richardhuaaa richardhuaaa changed the title refactor: use string topics Use strings for topics Oct 9, 2024
Copy link
Collaborator

neekolas commented Oct 9, 2024

I hear you on readability. But given that the topics mostly consist of 32 random bytes (inbox ID, group ID, installation ID) they're never going to be the most readable.

I think we suck it up and leave them as byte arrays with a reserved few bytes at the front to make them self-describing. It'll add up to a meaningful amount of storage and bandwidth in the long run. Especially since we have requests that might contain 10k topics.

We can always build nicer handlers in Go and Rust that take a topic, validate the format, and return a clean struct. Then no one needs to think about it again.

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