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

Method updateMap

flagext/map.go:72–88  ·  view source on GitHub ↗
(newMap map[string]T)

Source from the content-addressed store, hash-verified

70}
71
72func (m LimitsMap[T]) updateMap(newMap map[string]T) error {
73 // Validate first, as we don't want to allow partial updates.
74 if m.validator != nil {
75 for k, v := range newMap {
76 if err := m.validator(k, v); err != nil {
77 return err
78 }
79 }
80 }
81
82 clear(m.data)
83 for k, v := range newMap {
84 m.data[k] = v
85 }
86
87 return nil
88}
89
90// MarshalYAML implements yaml.Marshaler.
91func (m LimitsMap[T]) MarshalYAML() (interface{}, error) {

Callers 3

SetMethod · 0.95
UnmarshalYAMLMethod · 0.95
TestLimitsMap_updateMapFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestLimitsMap_updateMapFunction · 0.64