engine: resources: Add the proper prefix to grouped http resources

Resources that can be grouped into the http:server resource must have
that prefix. Grouping is basically hierarchical, and without that common
prefix, it means we'd have to special-case our grouping algorithm.
This commit is contained in:
James Shubin
2025-05-25 01:40:25 -04:00
parent 1f54253f95
commit 654e958d3f
35 changed files with 1513 additions and 1413 deletions

View File

@@ -58,17 +58,18 @@ func (ag *baseGrouper) Init(g *pgraph.Graph) error {
ag.graph = g // pointer
// We sort deterministically, first by kind, and then by name. In
// particular, longer kind chunks sort first. So http:ui:text should
// appear before http:server and http:ui. This is a hack so that if we
// are doing hierarchical automatic grouping, it gives the http:ui:text
// a chance to get grouped into http:ui, before http:ui gets grouped
// into http:server, because once that happens, http:ui:text will never
// get grouped, and this won't work properly. This works, because when
// we start comparing iteratively the list of resources, it does this
// with a O(n^2) loop that compares the X and Y zero indexes first, and
// and then continues along. If the "longer" resources appear first,
// then they'll group together first. We should probably put this into
// a new Grouper struct, but for now we might as well leave it here.
// particular, longer kind chunks sort first. So http:server:ui:input
// should appear before http:server and http:server:ui. This is a
// strategy so that if we are doing hierarchical automatic grouping, it
// gives the http:server:ui:input a chance to get grouped into
// http:server:ui, before http:server:ui gets grouped into http:server,
// because once that happens, http:server:ui:input will never get
// grouped, and this won't work properly. This works, because when we
// start comparing iteratively the list of resources, it does this with
// a O(n^2) loop that compares the X and Y zero indexes first, and then
// continues along. If the "longer" resources appear first, then they'll
// group together first. We should probably put this into a new Grouper
// struct, but for now we might as well leave it here.
//vertices := ag.graph.VerticesSorted() // formerly
vertices := RHVSort(ag.graph.Vertices())