Documentation
¶
Overview ¶
Package thumbdue is what the thumbnail stores share about the rows the renderer must look at (#2084). A row of resources, portal_assets or portal_collections carries thumbnail_due_at: when its owed rule next needs evaluating, NULL once the rule said it is owed nothing. A trigger sets it on every write the renderer did not make (migration 000189), and the stores read only due rows, through a partial index, so the cost of asking for work follows the rows that changed rather than the size of the library.
What the trigger cannot see is the rule changing under rows nobody wrote: a new renderer generation, a changed source bound, a newly drawable type. Sweep marks a whole table due once per rule, in chunks, and records the rule it marked under in thumbnail_sweeps.
Index ¶
Constants ¶
const NotifyChannel = "thumbnail_due"
NotifyChannel is the channel the trigger notifies when a row becomes due.
Variables ¶
This section is empty.
Functions ¶
func Rule ¶
Rule is the fingerprint of an owed rule: its SQL and the values bound into it, each as the driver sends it (a bound array is a pointer, whose address would change the fingerprint on every call). Two rules with the same fingerprint pass the same rows.
func Sweep ¶
Sweep marks every row of table due when rule is not the one it was last swept under, and records rule. It returns how many rows it marked: zero when the table was already swept under rule, or when another replica holds the sweep's lock (that replica records it). A row already due keeps its time; a claimed or held row is made due now and is still not claimed until its lease or hold passes.