Documentation
¶
Overview ¶
Package shield reconciles elchi-shield's watched config directory on the edge host to a control-plane-supplied desired state. elchi-shield self-watches that directory (fsnotify + debounce + atomic hot-reload + last-good), so the agent only lands files atomically — it never signals shield to reload.
Sync is two-phase to keep shield's view consistent. PREPARE validates every file and stages it into a sibling temp file (".tmp", which shield's loader ignores by extension) — slow work like downloads happens here, touching no live file, so any error aborts with the directory unchanged. COMMIT then renames the staged temps into place in a fast burst that shield's debounce coalesces into a single reload of the final state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListConfig ¶
func ListConfig(_ *logger.Logger) ([]*client.ShieldFile, error)
ListConfig returns the files currently under shield's config dir (path relative to the root, sha256, octal mode); content is omitted. A missing dir yields an empty list (not an error).
func SyncConfig ¶
SyncConfig reconciles shield's watched config directory (models.ShieldConfigPath) to match cfg. See the package doc for the two-phase model. On full_sync it also removes any managed file not in the set (deletions propagate). On a prepare-phase error the directory is left unchanged; a commit-phase error (rare — only a catastrophic rename failure) may leave earlier files applied, with the rest rolled back, and is reported.
Types ¶
This section is empty.