mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-09 16:00:59 +00:00
Dead-code sweep. Functions flagged unreachable by golang.org/x/tools/cmd/deadcode and confirmed unused across pulse, pulse-enterprise, pulse-pro and pulse-mobile by adversarial cross-repo verification. Cross-module reachability was checked explicitly (only pkg/ exported symbols are importable by other modules; internal/ packages and _test.go files are not). go build, go vet and test-compile all pass.
38 lines
934 B
Go
38 lines
934 B
Go
package mock
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/rcourtman/pulse-go-rewrite/internal/truenas"
|
|
)
|
|
|
|
func TrueNASPoolMetricID(hostname string, pool string) string {
|
|
return TrueNASScopedMetricID(hostname, "pool:"+strings.TrimSpace(pool))
|
|
}
|
|
|
|
func TrueNASDatasetMetricID(hostname string, dataset string) string {
|
|
return TrueNASScopedMetricID(hostname, "dataset:"+strings.TrimSpace(dataset))
|
|
}
|
|
|
|
func TrueNASAppMetricID(hostname string, app truenas.App) string {
|
|
appID := strings.TrimSpace(app.ID)
|
|
if appID == "" {
|
|
appID = strings.TrimSpace(app.Name)
|
|
}
|
|
if appID == "" {
|
|
return ""
|
|
}
|
|
return TrueNASScopedMetricID(hostname, "app:"+appID)
|
|
}
|
|
|
|
func TrueNASScopedMetricID(hostname string, sourceID string) string {
|
|
hostname = strings.TrimSpace(hostname)
|
|
sourceID = strings.TrimSpace(sourceID)
|
|
if hostname == "" {
|
|
return sourceID
|
|
}
|
|
if sourceID == "" {
|
|
return "system:" + hostname
|
|
}
|
|
return "system:" + hostname + "/" + sourceID
|
|
}
|