MCPcopy
hub / github.com/dgraph-io/dgraph / memoryLimitGetHandler

Function memoryLimitGetHandler

dgraph/cmd/alpha/admin.go:191–215  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

189}
190
191func memoryLimitGetHandler(w http.ResponseWriter, r *http.Request) {
192 gqlReq := &schema.Request{
193 Query: `
194 query {
195 config {
196 cacheMb
197 }
198 }`,
199 }
200 resp := resolveWithAdminServer(gqlReq, r, adminServer)
201 if len(resp.Errors) != 0 {
202 x.SetStatus(w, resp.Errors[0].Message, "Get cache_mb failed")
203 return
204 }
205 var data struct {
206 Config struct {
207 CacheMb float64
208 }
209 }
210 x.Check(json.Unmarshal(resp.Data.Bytes(), &data))
211
212 if _, err := fmt.Fprintln(w, data.Config.CacheMb); err != nil {
213 http.Error(w, err.Error(), http.StatusInternalServerError)
214 }
215}

Callers 1

memoryLimitHandlerFunction · 0.85

Calls 4

SetStatusFunction · 0.92
CheckFunction · 0.92
resolveWithAdminServerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected