-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Counter CRDT #320
Comments
I'm wondering if it could allow a more generic function name like Maybe as an option somehow? Ideally not at compile-time because that seems like a bit of pain. I assume you can register a function from another function? |
We could. I'm worried about name collisions though. Wouldn't there be a chance that some other extension includes an
Maybe 😅 Like register a function from within a function extension? |
I probably should've said a bit more... I was wondering if a function could be created to alias or deregister + re-register the |
Allow columns to be defined as counters rather than LWW.
Some basic background: https://www.cs.utexas.edu/~rossbach/cs380p/papers/Counters.html
API ideas:
We could use special functions to interact with count columns. E.g.,
UPDATE foo SET counter = crsql_incr(counter, amount)
where
crsql_incr
takes a counter crdt instance.@ivertom -- I remember you sketching out ideas for a counter but can't seem to track them down.
Implementation Ideas
Ideally we'll start with the most generic counter -- one that increments and decrements.
We'll need to track two lists of tuples:
and the "final" count is simply the sum of increments minus sum of decrements:
https://www.cs.utexas.edu/~rossbach/cs380p/papers/Counters.html#cvrdt-state-based-design-1
The final value is what should always be stored in the column. Backing data (e.g., sites and their counts) should be stored in some auxiliary table.
The auxiliary table could be something as simple as a table called
crsql_counters
which tracks state for all counters in the system:Issues
Workarounds
Compacting out history will be a later exercise.
The text was updated successfully, but these errors were encountered: