MCPcopy Create free account
hub / github.com/couchbase/cbft / scopeCollNames

Function scopeCollNames

prometheus.go:137–164  ·  view source on GitHub ↗
(params, sourceName string)

Source from the content-addressed store, hash-verified

135}
136
137func scopeCollNames(params, sourceName string) (string, []string) {
138 tmp := struct {
139 Mapping mapping.IndexMapping `json:"mapping"`
140 }{Mapping: bleve.NewIndexMapping()}
141
142 err := json.Unmarshal([]byte(params), &tmp)
143 if err != nil {
144 return "", nil
145 }
146
147 if im, ok := tmp.Mapping.(*mapping.IndexMappingImpl); ok {
148 scope, err := validateScopeCollFromMappings(sourceName,
149 im, true)
150 if err != nil {
151 return "", nil
152 }
153
154 if scope != nil && len(scope.Collections) > 0 {
155 rv := make([]string, len(scope.Collections))
156 for i, coll := range scope.Collections {
157 rv[i] = coll.Name
158 }
159 return scope.Name, rv
160 }
161 }
162
163 return "", nil
164}
165
166func getNsIndexStatsKey(indexName, sourceName, params string) string {
167 var colNames string

Callers 1

getNsIndexStatsKeyFunction · 0.85

Calls 2

UnmarshalMethod · 0.80

Tested by

no test coverage detected