-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
atomic counters #6
Comments
I guess the proposal is effectively asking for the server to serialize incr/decr commands from concurrent actors. I have a hard time thinking about write-only counters. Meaning if you need to read the value and decide how much to incr/decr, then you would want the That said, if eventual consistency of the counter is sufficient, then one option would be to have a model of state that have a live subscription to receives incr/decr operations and the value is derived. It doesn't solve the atomic problem, but agree that a live model of state could be useful. I had written up an API design for this a while ago, I will dig it up and post. |
CRDT is definitely another way ! This nats project models the data in a CRDT style: https://github.com/simpleiot/simpleiot/search?q=crdt It does not have as far as i can see a way to reconcile the state using CRDT yet from what i can see. But its interesting to see. they also use an embedded database btw called genji, which is backed by the cockroachdb pebble, which i am sure you know. https://github.com/genjidb/genji/blob/main/go.mod#L8 Its interesting to compare rita and siot. Sito uses a generalized type structure called points. https://github.com/simpleiot/simpleiot/blob/master/docs/adr/1-consider-changing-point-data-type.md |
@bruth " I had written up an API design for this a while ago, I will dig it up and post." |
@gedw99 There has been some internal discussion about a stream type/operation that enables an atomic counter. It is currently a stretch goal for the next minor release (2.10.0), but may land in the coming months. |
hey @bruth thanks for letting me know about this ! If there are any issues on the nats repo please do add here :) Also i am working on time smearing for nats. It basically keeps the time on all nodes the same and accounts for leap years. |
Rita looks really nice.
As per nats-io/nats-server#2656 It looks like Rita might be a good way to calculate atomic counters and other such things. In the issue the hack is to send +1 and -1 and then recalc and store the KV value.
The text was updated successfully, but these errors were encountered: