Documentation
¶
Overview ¶
Package overlay is the domain layer for catalog overlays: user-owned sparse spec patches applied on top of pristine catalog TEMPLATE rows to produce the EFFECTIVE rows the snapshot serves.
Why this exists: catalog-managed resources are re-seeded from the upstream catalog, and a direct edit to such a row is clobbered by the next re-seed (or, worse, blocks it). An overlay stores ONLY the fields the user changed; the merge happens at catalog load time (app/catalog snapshot build / reconcile), never in storage — so re-seeding replaces templates and is completely overlay-unaware, while un-overridden fields keep tracking the upstream catalog. Factory reset = delete the overlay row. Full design + decided trade-offs: docs/overlays.md.
Deliberately out of scope (v1): kinds other than "model"; diff-on-write against generic CRUD PUT (the overlay is an explicitly user-managed patch document); per-field replace-mode escalation on union fields; metadata/identity patches (a name-overriding overlay — a "clone" — is a designed future, not built); patching `enabled` (membership stays a sanctioned direct edit so the snapshot's enabled-filter semantics never depend on a merge).
store.go is the data-access layer for Overlay. Mirrors app/model/store.go.
Index ¶
Constants ¶
const KindModel = "model"
KindModel is the only overlayable kind in v1. The schema and store are kind-generic so new kinds are data, not migrations.
Variables ¶
This section is empty.
Functions ¶
func EffectiveModel ¶
EffectiveModel merges o onto the template model and validates the result. The returned model shares the template's Metadata (identity is never patchable); only Spec differs. An error means the merge produced an invalid effective row — callers QUARANTINE the overlay (serve the pristine template, log loudly) rather than failing the snapshot.
Types ¶
type Overlay ¶
type Overlay struct {
Kind string `json:"kind"`
ResourceID string `json:"resourceId"`
Patch json.RawMessage `json:"patch"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
}
Overlay is one user-owned sparse patch targeting a template row. Patch is a JSON object of SPEC fields only — top-level keys merge into the target's spec per the kind's Strategy (see merge.go). It is NOT a full resource: metadata is never patchable.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Overlay data-access type.