|
|
|
|
|
by bruth
1232 days ago
|
|
#1: This isn't a hard requirement to achieve the desired permissions. For the DriftDB use case, my understanding is that all members in the room have full pub/sub k/v permissions, so that could be achieved by declaring a new permission pinned to the room when the room is created or joined (this can be done dynamically without a config file reload). #2 Publishes do support optimistic concurrency control using the `Nats-Last-Expected-Sequence` (stream level) or `Nats-Last-Expected-Subject-Sequence` for the subject-level. This ensures to concurrent publishes will be serialized and all but one is rejected with "conflict wrong sequence" error. For example headers in Rust[0] and WS[1] [0]: https://docs.rs/async-nats/latest/async_nats/header/index.ht... |
|
#2 the optimistic concurrency headers don’t solve the problem here, e.g.:
- I increment a counter (seq: 1)
- I increment a counter again (seq: 2, expected last sequence: 1)
- I begin computing a snapshot, resulting in a counter value of 2
- You increment the counter (seq: 3, expected last sequence: 2)
- I complete the snapshot and publish it with a Nats-Rollup header
- Your event has been lost, the counter value is now 2