MCPcopy
hub / github.com/grafana/dskit / viewMessage

Function viewMessage

kv/memberlist/http_status_handler.go:169–183  ·  view source on GitHub ↗
(w http.ResponseWriter, kv *KV, msg Message, format string)

Source from the content-addressed store, hash-verified

167}
168
169func viewMessage(w http.ResponseWriter, kv *KV, msg Message, format string) {
170 c := kv.GetCodec(msg.Pair.Codec)
171 if c == nil {
172 http.Error(w, "codec not found", http.StatusNotFound)
173 return
174 }
175
176 val, err := c.Decode(msg.Pair.Value)
177 if err != nil {
178 http.Error(w, fmt.Sprintf("failed to decode: %v", err), http.StatusInternalServerError)
179 return
180 }
181
182 formatValue(w, val, format)
183}
184
185func viewKey(w http.ResponseWriter, store map[string]ValueDesc, key string, format string) {
186 if store[key].value == nil {

Callers 1

ServeHTTPMethod · 0.85

Calls 4

formatValueFunction · 0.85
DecodeMethod · 0.65
GetCodecMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected