Documentation
¶
Overview ¶
Package configguard installs complete configuration files through a detached rollback watchdog. The application supplies client-native, read-only validation; this package owns the file transaction and recovery journal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Target string
Candidate []byte
Expected Snapshot
RecoveryDir string
Executable string
WatchArgs []string
Timeout time.Duration
Validate func(context.Context, string) error
Verify func(context.Context, string) error
}
Options describes a complete candidate. Validate must read the complete file using the actual client in an isolated home. It is called for the saved original (when present), then the candidate. Verify must read the installed configuration through the live client and check every changed setting. Callbacks must be read-only and honor their context. They must not send model requests. Executable must dispatch WatchArgs followed by the manifest path to Watch; WatchArgs defaults to ["__config-watch"].
type RestoreOptions ¶
type RestoreOptions struct {
Directory string
Executable string
WatchArgs []string
Timeout time.Duration
Validate func(context.Context, string) error
Verify func(context.Context, string) error
}
RestoreOptions identifies a prior committed Apply. Restore refuses to overwrite any change made since that candidate was installed.
type Result ¶
type Snapshot ¶
type Snapshot struct {
Exists bool `json:"exists"`
SHA256 string `json:"sha256,omitempty"`
Mode uint32 `json:"mode,omitempty"`
}
Snapshot is a complete optimistic concurrency check, including absence and permission changes. Obtain it with Inspect before constructing a candidate.
type Status ¶
type Status struct {
State string `json:"state"`
Reason string `json:"reason,omitempty"`
Current Snapshot `json:"current"`
WatcherPID int `json:"watcher_pid"`
At time.Time `json:"at"`
}
Status is the durable outcome written by the sole configuration writer. A preserved_concurrent_change outcome always requires inspection by a human.
func ReadStatus ¶
ReadStatus reads a private transaction's durable terminal status.