package resolution import ( "fmt" mcat "git.novox.be/novox/mesh-sdk/go/catalogue" ) // UnknownFieldReason is why a module whose stored manifest has a key this reader does not know is left out of a // machine's declaration, or "" when it is not. **A field set aside no longer leaves the module out** (novox/hq ADR 0578 // ยง6, which changes ADR 0262 here): the lenient decoder reads the rest, the reader names the field (SetAside), and the // part that needs the field takes the newer package. Only a manifest not read past the field, which holds its name and // version alone (ReadNoFurther), is still left out, since nothing of it could be composed. func UnknownFieldReason(m mcat.Manifest) string { if !m.ReadNoFurther() { return "" } return m.Module + " uses a field this controller does not know (" + m.UnknownField() + "); it is left out " + "until the controller is updated: nothing of it is changed on its machines and its contributions to " + "other modules and its open ports stop. Its data is still backed up as this controller reads it, " + "which may not be what its newer manifest asks, and it still provides what it provides " + "(novox/hq ADR 0262)" } // backupView is what of a left-out module still reaches its machine: its data, so the backup holder // keeps copying it, and the directories and accesses its data items name. No contribution, shell code // or environment of its own: those are what leaving it out stops. func backupView(m mcat.Manifest) mcat.Manifest { view := mcat.Manifest{Module: m.Module, Data: m.Data, Accesses: m.Accesses, BestEffort: true} for _, r := range m.Resources { if fmt.Sprint(r["type"]) == "directory" { view.Resources = append(view.Resources, r) } } return view }