mcap icon indicating copy to clipboard operation
mcap copied to clipboard

feat: add ids to channel and schema types

Open alxhill opened this issue 1 year ago • 0 comments

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:

  1. 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.
  2. create a new MessageStream that returns message header with the message (or some other new combined type)
  3. Split the Channel struct into readable/writeable versions. Seems like a fairly invasive change but may be helpful in the long-run?

alxhill avatar Sep 30 '24 18:09 alxhill