minimq icon indicating copy to clipboard operation
minimq copied to clipboard

Refactor session state message storage

Open ryan-summers opened this issue 3 years ago • 0 comments

Currently, messages with QoS > AtMostOnce are stored in the SessionState. MQTT requires that we republish these messages upon reconnection with the broker in the same order as originally published.

Currently, we store the messages in two datastructures. One is a vector of message IDs (in order) and the other is a map of the messages (where the ID is the key to the map).

It would be desirable to combine these into a single datastructure. Some requirements:

  • Removing an element must not result in large copies, as this may result in copying far too much memory if there's a lot of pending messages
  • A single data structure should be used
  • An ideal implementation may allow us to not hold any additional buffer space (e.g. when QoS AtMostOnce is used exclusively).

ryan-summers avatar Aug 23 '22 07:08 ryan-summers