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

Function computeStoreSizes

kv/memberlist/http_status_handler.go:138–157  ·  view source on GitHub ↗
(kv *KV, store map[string]ValueDesc)

Source from the content-addressed store, hash-verified

136}
137
138func computeStoreSizes(kv *KV, store map[string]ValueDesc) (sizes map[string]int, total int) {
139 sizes = make(map[string]int, len(store))
140 for key, val := range store {
141 if val.value == nil {
142 continue
143 }
144 c := kv.GetCodec(val.CodecID)
145 if c == nil {
146 continue
147 }
148 encoded, err := c.Encode(val.value)
149 if err != nil {
150 continue
151 }
152 size := len(encoded)
153 sizes[key] = size
154 total += size
155 }
156 return
157}
158
159func getFormat(req *http.Request) string {
160 const viewFormat = "format"

Callers 1

ServeHTTPMethod · 0.85

Calls 2

EncodeMethod · 0.65
GetCodecMethod · 0.45

Tested by

no test coverage detected