Concurrency strategy that implements the optimistic rebase-replay protocol
required for multi-peer synchronisation.
Behaviour:
Local "commit" intents are applied as transients (negative time) and
wait for the sync server's echoed committed envelope to promote them
via rollback-and-replay. This is required for cross-peer entity-id
determinism under concurrent edits.
Every outbound envelope is stamped with userId so the reconciler's
compound (userId, id) key keeps concurrent peers' id counters from
colliding.
onBeforeToData / onAfterToData roll back and replay the transient
queue around serialisation so snapshots always contain only committed state.
Parameters
userId: string|number
Stable peer/session identifier unique across all peers
sharing the same sync server.
Concurrency strategy that implements the optimistic rebase-replay protocol required for multi-peer synchronisation.
Behaviour:
userIdso the reconciler's compound(userId, id)key keeps concurrent peers' id counters from colliding.onBeforeToData/onAfterToDataroll back and replay the transient queue around serialisation so snapshots always contain only committed state.