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

Function refreshMetaFieldValCache

collection_utils.go:51–70  ·  view source on GitHub ↗

refreshMetaFieldValCache updates the metaFieldValCache with the latest index definitions.

(indexDefs *cbgt.IndexDefs)

Source from the content-addressed store, hash-verified

49// refreshMetaFieldValCache updates the metaFieldValCache with
50// the latest index definitions.
51func refreshMetaFieldValCache(indexDefs *cbgt.IndexDefs) {
52 if indexDefs == nil || metaFieldValCache == nil {
53 return
54 }
55
56 bleveParams := NewBleveParams()
57 for _, indexDef := range indexDefs.IndexDefs {
58 err := json.Unmarshal([]byte(indexDef.Params), bleveParams)
59 if err != nil {
60 log.Printf("collection_utils: refreshMetaFieldValCache,"+
61 " indexName: %v, err: %v", indexDef.Name, err)
62 continue
63 }
64 if strings.HasPrefix(bleveParams.DocConfig.Mode, ConfigModeCollPrefix) {
65 if im, ok := bleveParams.Mapping.(*mapping.IndexMappingImpl); ok {
66 _ = initMetaFieldValCache(indexDef.Name, indexDef.SourceName, im)
67 }
68 }
69 }
70}
71
72func (c *collMetaFieldCache) getMetaFieldValue(indexName, collName string) string {
73 c.m.RLock()

Callers 1

RunRecentInfoCacheFunction · 0.85

Calls 3

NewBleveParamsFunction · 0.85
initMetaFieldValCacheFunction · 0.85
UnmarshalMethod · 0.80

Tested by

no test coverage detected