feat: add ids to channel and schema types #1245
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog
Add
id
fields to theSchema
andChannel
structs.Docs
None
Description
The Channel ID is needed to be able to distinguish two channels with the same topic name, which are not guaranteed to be unique. I've also added the ID to the Schema type for consistency but this is not strictly necessary for us/our use case.
One challenge here is that the Channel and Schema types are used for both read and write workflows, but for write workflows it would be ignored (e.g
add_channel
generates a new channel id). In this PR I ignored the additional field, but would be happy to refactor another way. Some options I came up with:Option<u16>
and set it on read. Simple enough, but makes the contract of when it will/won't be set (or how it'll behave if the field is set on write) unclear.MessageStream
that returns message header with the message (or some other new combined type)Channel
struct into readable/writeable versions. Seems like a fairly invasive change but may be helpful in the long-run?