Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from xmtp/rich/vector-clock-map
It's slowly becoming more apparent that the `sid` concept isn't very useful compared to having separate `node_id` and `sequence_id` fields: 1. We've removed gateway sequence ID's, so there's much less potential for confusion between local and remote sequence ID's 2. We're using a separate `uint32` node ID field in various places already, including `target_originator`, `publisher_node_id` and inside `EnvelopesQuery` 3. Updating and manipulating vector clocks are now a lot more important on both server and client, and using a `map<node_id, sequence_id>` type is more ergonomic compared to a list of sids. Protobufs use a `varint` under the hood, so there shouldn't be much size difference, exactly as @neekolas pointed out originally. This should also make the spec easier to understand and explain, and gives us more bits to work with for both node ID's and sequence ID's. One con: - With the current server implementation using postgres, which only understands int32 and int64, there is some potential for error converting between signed and unsigned types. I'll make sure to add server code to check for overflows, with the idea that we would be migrating long before we use up the entire bit-space.
- Loading branch information