Data integrity
Optimistic locking
Every write that changes a record advances its version, and every read and write answers with an
ETag: "v<n>". A save names the version it started from in If-Match, and the update succeeds only
if that is still the current version.
| Situation | Answer |
|---|---|
| Someone saved first | 409 VERSION_CONFLICT, with the record as it stands, who changed it, when, and which columns |
| The record is in a final state | 409 RECORD_FINAL |
No If-Match on an optimistic table | 428 |
If-Match: * | A deliberate overwrite |
The screen turns a conflict into a dialog: refresh to the current record, or overwrite naming its version. Deletes are held to the same rules, and a record in a final state is never deleted.
Values and references
- A value-list column refuses a value the list does not hold.
- A reference refuses an id that points at nothing.
- A narrowed reference refuses a record outside the narrowed set, checked against the stored row with the request laid over it.
These checks apply to the columns a request writes, so a row stored before a rule existed can still be edited.