Documentation
¶
Overview ¶
Package detect turns on the controls a descriptor's repositories call for, for a descriptor that sets config.detect: the ones a scan with no descriptor turns on for the same files.
Every command that acts on a descriptor goes through Apply, so a scan, `draugr doctor` and the MCP server's scan agree about what a descriptor turns on. `draugr validate` does not: it checks what the file says, and what the file says is `detect: true`.
Index ¶
Constants ¶
const UnreadReason = "not a directory on this machine, so config.detect read none of its files"
UnreadReason is why a repository was not read, in the words the run prints.
A remote repository is fetched by the scan's jobs, which start once the controls are decided, so there is no copy of it to read while deciding them. Reading it here would mean a second clone of every remote repository on every command that loads the descriptor, doctor included.
Variables ¶
This section is empty.
Functions ¶
func Layer ¶
func Layer(detected, written map[string]saga.ControllerSettings) map[string]saga.ControllerSettings
Layer lays the controls a descriptor writes over the ones detected: each control the descriptor names keeps every setting it writes, `enabled: false` included, and takes the detected settings it does not write. A control it does not name stays as detected.
func Merge ¶
Merge is one tree holding what each of trees holds, for deciding what they call for together.
Every list in a Tree is appended, by reflection rather than by name, so a kind of file the inventory learns to find reaches detect without anybody remembering to add it here. The paths stay relative to their own repository, which is enough for what is decided from them: whether a kind of file is there, and how a requirements file is named.
Types ¶
type Repository ¶
type Repository struct {
// URL is the repository as the descriptor names it.
URL string
// Components are the components naming it, in the descriptor's order.
Components []string
// Tree is what the repository holds.
Tree inventory.Tree
}
Repository is one repository detect read, and the components that name it.
type Result ¶
type Result struct {
// Read are the local repositories, each once, in the order the descriptor first names them.
Read []Repository
// Unread are the repositories detect could not read, each once.
Unread []Unread
// Written is the descriptor's own controls and reachability analysis, as it wrote them.
Written saga.Config
}
Result is what detect read, and what the descriptor wrote itself before anything was detected.
func Apply ¶
Apply turns on what m's local repositories call for, beneath the controls m writes itself, and returns what it read. A model that does not set config.detect is left as it is, with a nil Result: a descriptor written without the field runs the controls it names and nothing else.
func ApplyWith ¶
ApplyWith is Apply reading each local repository with read, for a caller that has already read the tree and a test that hands one over.
The controls are one set for the whole descriptor, as config.controls is: a scanner one repository's files call for runs on every repository, and reads nothing where it has nothing to read. Each repository is read whole, whatever paths: and ignore: narrow a component to, because a control turned on for the descriptor runs on every component anyway.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chosen is what config.detect chose for a descriptor's files, and what becomes of a scanner it chose that this machine cannot run.
|
Package chosen is what config.detect chose for a descriptor's files, and what becomes of a scanner it chose that this machine cannot run. |