MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / contentStateSQLFor

Function contentStateSQLFor

internal/store/items.go:838–845  ·  view source on GitHub ↗

contentStateSQLFor is contentStateSQL for a query that aliases the items table as something other than `i` — the backlink queries call it `s`, since the row they describe is the SOURCE item of a link (BUG-3033). A function rather than a second copy: two hand-maintained spellings of this predicate w

(alias string)

Source from the content-addressed store, hash-verified

836// predicate would be two chances to drift, and a predicate that disagreed with
837// itself between doors is the shape of the defect this whole family is about.
838func contentStateSQLFor(alias string) string {
839 // Set-aside rows first (BUG-3244): when an item has both, the edits no tab
840 // can recover are the claim a reader must not miss, and set-aside rows do
841 // not depend on the watermark, so a tab stamping it cannot clear them.
842 return `CASE WHEN ` + setAsideExistsSQLFor(alias) +
843 ` THEN 'superseded_set_aside' WHEN ` + pendingFlushExistsSQLFor(alias) +
844 ` THEN 'applied_pending_flush' ELSE '' END`
845}
846
847// pendingFlushExistsSQLFor is the BUG-3000 half of contentStateSQLFor on its
848// own: unflushed content-bearing op-log rows. A door that must ask about the

Callers 3

GetBacklinksMethod · 0.85
items.goFile · 0.85

Calls 2

setAsideExistsSQLForFunction · 0.85
pendingFlushExistsSQLForFunction · 0.85

Tested by

no test coverage detected