MCPcopy Index your code
hub / github.com/deepflowio/deepflow / getCache

Function getCache

cli/ctl/recorder.go:72–108  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, subDomain string, onlyDiffBase, onlyToolMap bool, resourceType, field string)

Source from the content-addressed store, hash-verified

70}
71
72func getCache(cmd *cobra.Command, args []string, subDomain string, onlyDiffBase, onlyToolMap bool, resourceType, field string) {
73 if len(args) == 0 {
74 fmt.Fprintf(os.Stderr, "must specify domain lcuuid.\nExample: %s\n", cmd.Example)
75 return
76 }
77
78 lcuuid := args[0]
79 server := common.GetServerInfo(cmd)
80 url := fmt.Sprintf("http://%s:%d/v1/recorders/%s/%s/cache/", server.IP, server.Port, lcuuid, subDomain)
81 if onlyDiffBase {
82 url += "diff-bases/"
83 } else if onlyToolMap {
84 url += "tool-maps/"
85 }
86
87 resp, err := common.CURLResponseRawJson("GET", url, []common.HTTPOption{common.WithTimeout(common.GetTimeout(cmd))}...)
88 if err != nil {
89 fmt.Fprintln(os.Stderr, err)
90 return
91 }
92 data := resp.Get("DATA")
93 if resourceType != "" {
94 resources := strings.Split(resourceType, ",")
95 for _, r := range resources {
96 fmt.Println(r)
97 common.PrettyPrint(data.Get(r))
98 }
99 } else if field != "" {
100 resources := strings.Split(field, ",")
101 for _, r := range resources {
102 fmt.Println(r)
103 common.PrettyPrint(data.Get(r))
104 }
105 } else {
106 common.PrettyPrint(data)
107 }
108}

Callers 1

RegisterRecorderCommandFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected