docker's daemon file names the image seat's reach while its manifest stays, so the hold read from the manifest alone let an engine before the reading lose the file. The forge bridge reads each manifest's templates at the merge and carries the module's needs whole; the indexer takes them, keeps them past the judge, and holds any changed entry, not only a new manifest digest. A hold standing past 30 minutes is the finding manifest-held, its bound a key of the new state hold-bounds that expires; its expiry and the start weigh the holds again, so a restart loses no bound. A hold moved by hand names the nodes it strands, in its answer and its hand act. The hold test is a case of the manifests test, not a function of its own. Claude-Session: https://claude.ai/code/session_01JG73KG7AfSdh6FP8VrBqCn
65 lines
2.9 KiB
Go
65 lines
2.9 KiB
Go
package bridge
|
|
|
|
// A merge of a repository of many modules read three files of the forge for every module, whatever the merge changed:
|
|
// the catalogue's 140 modules are 420 reads, which no longer fit the 30 s bound of a handled event while the forge is
|
|
// busy after a merge, so the merged message of mesh-catalog#535 was never written and the indexer never saw it (issue
|
|
// 1126; issue 1458 met the same kind at 131 modules and raised the reads in flight). A directory's git tree hash names
|
|
// every byte under it, so the manifest and the lock-file hashes read once at a tree hash are those of every later commit
|
|
// whose directory has the same tree: a merge reads the forge only for the directories it changed.
|
|
|
|
// Inputs is what the bridge read of one module directory at one tree hash: its manifest and its lock files' hex sha256
|
|
// by name (none when it has none). The bridge reads no mesh package (novox/hq ADR 0593 §2: only the indexer computes
|
|
// what a fingerprint takes); a value kept with the packages an older bridge read is taken, and those are left.
|
|
type Inputs struct {
|
|
Manifest string `json:"manifest"`
|
|
Locks map[string]string `json:"locks,omitempty"`
|
|
// Needs are the module's needs whole when its manifest names templates (inputsRead): a value of such a manifest kept
|
|
// without them, by a bridge before ADR 0632 §2, is read again.
|
|
Needs []string `json:"needs,omitempty"`
|
|
}
|
|
|
|
// Kept holds Inputs by a directory's git tree hash (the bridge's state bucket inputs). Get answers false for a tree it
|
|
// does not hold or cannot read; Put is best effort: a value it could not keep is read from the forge next time.
|
|
type Kept interface {
|
|
Get(tree string) (Inputs, bool)
|
|
Put(tree string, in Inputs)
|
|
}
|
|
|
|
// keptInputs splits dirs into the inputs kept for their tree hash and the directories still to read from the forge.
|
|
func keptInputs(dirs []string, trees map[string]string, kept Kept) (manifests map[string]string, locks map[string]map[string]string, needs map[string][]string, read []string) {
|
|
manifests, locks, needs = map[string]string{}, map[string]map[string]string{}, map[string][]string{}
|
|
for _, dir := range dirs {
|
|
tree := trees[dir]
|
|
if kept == nil || tree == "" {
|
|
read = append(read, dir)
|
|
continue
|
|
}
|
|
in, ok := kept.Get(tree)
|
|
if !ok || (in.Needs == nil && len(templatePaths(in.Manifest)) > 0) {
|
|
read = append(read, dir)
|
|
continue
|
|
}
|
|
manifests[dir] = in.Manifest
|
|
if len(in.Locks) > 0 {
|
|
locks[dir] = in.Locks
|
|
}
|
|
if in.Needs != nil {
|
|
needs[dir] = in.Needs
|
|
}
|
|
}
|
|
return manifests, locks, needs, read
|
|
}
|
|
|
|
// keep puts what was read of each directory under its tree hash.
|
|
func keep(dirs []string, trees map[string]string, manifests map[string]string, locks map[string]map[string]string, needs map[string][]string, kept Kept) {
|
|
if kept == nil {
|
|
return
|
|
}
|
|
for _, dir := range dirs {
|
|
raw, ok := manifests[dir]
|
|
if tree := trees[dir]; ok && tree != "" {
|
|
kept.Put(tree, Inputs{Manifest: raw, Locks: locks[dir], Needs: needs[dir]})
|
|
}
|
|
}
|
|
}
|