-
Notifications
You must be signed in to change notification settings - Fork 9
Description
[This requires some bigger changes in the client as well as storage, so mostly noting for future discussion]
When multiple tabs are open and each derives the same values that are then synced, we're going to see a lot more conflicts, since they all derive the same values, often triggered by the same underlying change. There's of course an optimization downstream to not sync those changes at all, but let's not rely on that alone. Instead we could support conflict semantics that match the idea of derived data:
Each change could specify what data and what version of the data the change is based on:
- Today's CAS behavior is effectively a change that depends on the previous value only
- A derived value is a change that depends on other data at specific versions
A transaction is allowed when
- The current value isn't based on any newer data than the proposed transaction depends on
- If the transaction depends on the to be changed document, then it must be based on the current version of the document
Note: A transaction might refer to a value it changes itself, so it'll have to express "current transaction" as version. TBD whether we should allow cycles (in principle a propagator network could that came to a stable point after several iterations could look like that, but maybe we want to record that differently).
For derive we need to base it on since, so it's comparable. Hence I wonder whether we should change that for self-referential changes as well, or keep cause as today. (We'd still want to store a causal chain, though interestingly atproto only does that for commits, capturing the before and after hashes)