|
|
@@ -1,8 +1,8 @@
|
|
|
-// facet.go — the "facet" topology-override kind (NETPULSE-ONE-LEGION).
|
|
|
+// facet.go - the "facet" topology-override kind (NETPULSE-ONE-LEGION).
|
|
|
//
|
|
|
// An external agent push is contractually a router, so a pusher that
|
|
|
// describes an EXISTING host (the RKE2 agent on the legion box) mints a
|
|
|
-// box for a machine the fleet already draws — two representations of one
|
|
|
+// box for a machine the fleet already draws - two representations of one
|
|
|
// host is a lie on the map. A facet override says: the target row (agent
|
|
|
// slug, non-MAC ids accepted per the #1485 precedent) is not a new box
|
|
|
// but another face of the device whose MAC is the parent.
|
|
|
@@ -14,7 +14,7 @@
|
|
|
// panels (system vitals + workloads) inside the device's detail view.
|
|
|
//
|
|
|
// Graceful-degradation rule: a facet only folds when BOTH ends are
|
|
|
-// present — the target router in the list and the parent device in the
|
|
|
+// present - the target router in the list and the parent device in the
|
|
|
// census. A facet that cannot render leaves the box standing (a box is
|
|
|
// honest; a swallowed row is not), and no ghost box can reappear while
|
|
|
// the override is enabled: staleness rides on DeviceFacet.Online, which
|
|
|
@@ -45,7 +45,7 @@ type DeviceFacet struct {
|
|
|
// Online mirrors the faceted router row's status so a stopped pusher
|
|
|
// badges the device instead of drawing a box.
|
|
|
Online bool `json:"online"`
|
|
|
- // Workloads is the agent's last reported guest census (count only —
|
|
|
+ // Workloads is the agent's last reported guest census (count only -
|
|
|
// the full list is detail data, fetched from the router's detail
|
|
|
// endpoint when the panel opens). 0 with WorkloadsKnown false means
|
|
|
// the agent never reported the section.
|
|
|
@@ -53,7 +53,7 @@ type DeviceFacet struct {
|
|
|
WorkloadsKnown bool `json:"workloadsKnown,omitempty"`
|
|
|
// WorkloadItems is the bounded sample of the census the canvas grids
|
|
|
// as CT chips under the host (the facet→hypervisor bridge,
|
|
|
- // FACET-TOPOLOGY-CANVAS). Capped at facetWorkloadItemCap — Workloads
|
|
|
+ // FACET-TOPOLOGY-CANVAS). Capped at facetWorkloadItemCap - Workloads
|
|
|
// stays the true total. Non-running items always survive the cap:
|
|
|
// a down guest must stay findable in the sample, so the fill order
|
|
|
// keeps every not-running item before trimming running ones.
|
|
|
@@ -75,7 +75,7 @@ type censusFunc func(routerID string) (items []probe.WorkloadItem, count int, ok
|
|
|
// parents. When nothing folds, the inputs are returned untouched.
|
|
|
func foldFacetRouters(routers []Router, devices []Device, overrides []TopologyOverride,
|
|
|
census censusFunc) ([]Router, []Device) {
|
|
|
- // Index enabled facets: target id (lowercased — targets may be router
|
|
|
+ // Index enabled facets: target id (lowercased - targets may be router
|
|
|
// slugs, and the #1485 lane already matches those case-insensitively)
|
|
|
// → override. First enabled row per target wins (List is ordered by
|
|
|
// enabled DESC, created ASC).
|
|
|
@@ -151,7 +151,7 @@ func foldFacetRouters(routers []Router, devices []Device, overrides []TopologyOv
|
|
|
|
|
|
// censusOfLastPolled reports the last workload census an agent pushed
|
|
|
// (live state; ok=false when the agent never reported the section or the
|
|
|
-// census is older than the #2236 TTL — a dead pusher must not keep painting
|
|
|
+// census is older than the #2236 TTL - a dead pusher must not keep painting
|
|
|
// facet counts and CT chips, only its offline badge).
|
|
|
func (l *Live) censusOfLastPolled(id string) ([]probe.WorkloadItem, int, bool) {
|
|
|
l.mu.Lock()
|
|
|
@@ -169,7 +169,7 @@ func (l *Live) censusOfLastPolled(id string) ([]probe.WorkloadItem, int, bool) {
|
|
|
|
|
|
// capWorkloadSample trims a census to `cap` items for the facet pointer
|
|
|
// without hiding a problem: every not-running item is kept first (the
|
|
|
-// down-state needle must survive the cut — the canvas paints it in warn
|
|
|
+// down-state needle must survive the cut - the canvas paints it in warn
|
|
|
// and the tooltip counts it), then running ones fill the rest in census
|
|
|
// order. The copy never aliases the polled slice's backing array (#1378
|
|
|
// law: projections do not share live state).
|
|
|
@@ -210,7 +210,7 @@ func workloadRunning(state string) bool {
|
|
|
// foldFacetedRouters drops agent rows the fleet declared as facets of an
|
|
|
// existing device from a router list, checking parent presence against
|
|
|
// the attributed device census (a facet whose host is gone keeps its
|
|
|
-// box — the fold never swallows a row it cannot render).
|
|
|
+// box - the fold never swallows a row it cannot render).
|
|
|
func (l *Live) foldFacetedRouters(routers []Router) []Router {
|
|
|
if l.db == nil {
|
|
|
return routers
|
|
|
@@ -235,7 +235,7 @@ func (l *Live) foldFacetedDevices(devices []Device) []Device {
|
|
|
}
|
|
|
// The fold learns the facet's status and census from the ROUTER rows,
|
|
|
// so the device half needs them too: pass the unfolded base list (the
|
|
|
- // nil-routers call would fold nothing — there would be no target).
|
|
|
+ // nil-routers call would fold nothing - there would be no target).
|
|
|
_, d := foldFacetRouters(l.routerRows(), devices, ov, l.censusOfLastPolled)
|
|
|
return d
|
|
|
}
|