MCPcopy Index your code
hub / github.com/docker/docker-agent / toolsetDetails

Function toolsetDetails

pkg/runtime/runtime.go:882–907  ·  view source on GitHub ↗

toolsetDetails builds one ToolsetDetail per live toolset of the agent, combining the side-effect-free lifecycle status with tool names: live names for started toolsets, otherwise the declared `tools:` allow-list keyed by the same name the registry assigns (cmp.Or(name, type)).

(ctx context.Context, a *agent.Agent, cfg latest.AgentConfig, hasCfg bool)

Source from the content-addressed store, hash-verified

880// for started toolsets, otherwise the declared `tools:` allow-list keyed by the
881// same name the registry assigns (cmp.Or(name, type)).
882func toolsetDetails(ctx context.Context, a *agent.Agent, cfg latest.AgentConfig, hasCfg bool) []ToolsetDetail {
883 toolSets := a.ToolSets()
884 if len(toolSets) == 0 {
885 return nil
886 }
887 var declared map[string][]string
888 if hasCfg {
889 declared = declaredToolNames(cfg)
890 }
891 infos := make([]ToolsetDetail, 0, len(toolSets))
892 for _, ts := range toolSets {
893 status := toolsetStatusFor(ts)
894 info := ToolsetDetail{
895 Name: status.Name,
896 Kind: status.Kind,
897 State: toolsetStateBucket(status.State),
898 }
899 if live, ok := startedToolNames(ctx, ts); ok {
900 info.Tools = live
901 } else if names, ok := declared[status.Name]; ok {
902 info.Tools = names
903 }
904 infos = append(infos, info)
905 }
906 return infos
907}
908
909// toolsetStateBucket collapses the lifecycle state machine into the inspector's
910// three buckets. Failed is the only error state; Stopped (including a

Callers 1

AgentConfigInfoMethod · 0.85

Calls 5

declaredToolNamesFunction · 0.85
toolsetStatusForFunction · 0.85
toolsetStateBucketFunction · 0.85
startedToolNamesFunction · 0.85
ToolSetsMethod · 0.80

Tested by

no test coverage detected