MCPcopy
hub / github.com/coredns/coredns / SetValueFunc

Function SetValueFunc

plugin/metadata/provider.go:102–110  ·  view source on GitHub ↗

SetValueFunc set the metadata label to the value function. If no metadata can be found this is a noop and false is returned. Any existing value is overwritten.

(ctx context.Context, label string, f Func)

Source from the content-addressed store, hash-verified

100// SetValueFunc set the metadata label to the value function. If no metadata can be found this is a noop and
101// false is returned. Any existing value is overwritten.
102func SetValueFunc(ctx context.Context, label string, f Func) bool {
103 if metadata := ctx.Value(key{}); metadata != nil {
104 if m, ok := metadata.(md); ok {
105 m[label] = f
106 return true
107 }
108 }
109 return false
110}
111
112// md is metadata information storage.
113type md map[string]Func

Callers 15

ServeDNSMethod · 0.92
wildcardMetadataBackendFunction · 0.92
MetadataMethod · 0.92
ServeDNSMethod · 0.92
MetadataMethod · 0.92
TestMetadataFunction · 0.92
MetadataMethod · 0.92
ServeDNSMethod · 0.92
MetadataMethod · 0.92
LookupMethod · 0.92
TestHandlerFunction · 0.92
setASNMetadataMethod · 0.92

Calls 1

ValueMethod · 0.80

Tested by 7

wildcardMetadataBackendFunction · 0.74
MetadataMethod · 0.74
TestMetadataFunction · 0.74
MetadataMethod · 0.74
TestHandlerFunction · 0.74
testCaseFunction · 0.74
MetadataMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…