mcap
mcap copied to clipboard
feat: add ids to channel and schema types
Changelog
Add id fields to the Schema and Channel 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:
- make the field
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. - create a new
MessageStreamthat returns message header with the message (or some other new combined type) - Split the
Channelstruct into readable/writeable versions. Seems like a fairly invasive change but may be helpful in the long-run?