lww_conflict_handler

Function lww_conflict_handler 

Source
pub fn lww_conflict_handler(
    conflict_type: ConflictType,
    ctx: &ConflictContext,
    schema: &TableSchema,
    tracker: &mut ConflictTracker,
) -> ConflictAction
Expand description

The production conflict handler for apply_changeset_with_context.

Rules:

  • DATA (same row, both sides edited): compare _updated_at. Newer wins. For release_files, records the row ID so device-specific columns can be restored by the caller.
  • NOTFOUND (row deleted locally, incoming UPDATE): OMIT (delete wins).
  • CONFLICT (row exists, incoming INSERT): compare _updated_at. Newer wins.
  • CONSTRAINT (FK violation): OMIT and track for retry.
  • FOREIGN_KEY: OMIT (deferred FK check failure, handled by retry).