maxpert / marmot

A distributed SQLite replicator built on top of NATS
https://maxpert.github.io/marmot/
MIT License
1.86k stars 42 forks source link

Use Nats-Expected-Last-Sequence etc. to manage competing updates more deterministically #80

Closed idearat closed 1 year ago

idearat commented 1 year ago

In reading over some of the Nats docs I ran across a note re the two headers Nats uses to "enforce optimistic concurrency" on a stream level or a per-subject level. https://github.com/nats-io/nats-server/discussions/3772

Not sure if you're currently making use of these but perhaps they might help ensure that operations at least always replay in the proper order since those headers ensure you can't write to the stream if you're out of sequence.

Just a thought.

Love what you're doing here!