Sync / Editing server data

Build outward

Absorbing. On a clock, absorb records, as the server's own operation, that the table holds every edit through the recovery cursor. Every replica drops those edits, and the journal compacts the log behind them, so a new replica is sent a small snapshot, not the history. It never compacts past what recovery has applied. Let only the server append it: an authorize rule on the contract.

Held edits. When the slice drops an edit whose row this page has cached at an older revision, the row would show the stale read until it is read again. reconcile keeps such an edit's overlay, held, and returns it in held, so the page can ask for its row again; once a read reaches the edit, the overlay is lifted.

Conflicts. The later commit wins, by the journal's order, not by edit time: an edit made offline earlier but committed later wins. replaced tells a page whose own edit lost: its replica wrote the cell, and another replica's commit holds another value. It compares replicas, not people, so the same person's two tabs are told of each other. When the journal absorbed the winning edit before the losing page heard of it, the slice no longer says whose it was; reconcile sees it in the row, when a read reaches this replica's edit (at or past it, another value), returns it in replaced, and the page says "a later edit". The read may be live: the edit is then still in the slice, and reconcile keeps its landed overlay to notice.

Refusals. A refused operation comes back with its rejection, the operation itself included, and the replica drops it. cellsOf names what it changed, so the page can mark the cells and say why.

Marks. Each cell can say where its edit is: not yet sent, saved and not yet in the table, refused, replaced, and where another device is. The grid's GridMarkStyle and GridLegend draw them.

An unchanged cell is no edit. The grid reports nothing for a draft left as it began, judged against the text the edit began from, not the row as it is now; otherwise leaving an editor as it opened would write the old value over a change another device made meanwhile.