package dbsync import ( "context" "database/sql" "time" ) const ( EntryDrain = "drain" EntryAgentPush = "agent_push" EntryRollback = "rollback" OutcomeApplied = "applied_source" OutcomeKept = "kept_target" OutcomeRolled = "rolled_back" ) // RecordLwwOverride 在 LWW 覆盖或保留目标时写入超管审计(失败忽略,不挡同步)。 func RecordLwwOverride(store *FileStore, o LwwOverride) { if store == nil { return } _ = store.AddLwwOverride(o) } // SnapshotTargetRow 取目标端当前行 JSON(无行则空串)。 func SnapshotTargetRow(ctx context.Context, db *sql.DB, driver Driver, table, pkCol, rowPK string) string { if db == nil || rowPK == "" { return "" } js, _, err := FetchRowJSON(ctx, db, driver, table, pkCol, rowPK) if err != nil { return "" } return js } // DefaultLwwAuditTTL 默认 90 天。 func DefaultLwwAuditTTL() time.Duration { return 90 * 24 * time.Hour }