MCPcopy Create free account
hub / github.com/Restream/reindexer / tryToAddNewTag

Method tryToAddNewTag

cjson/decoder.go:603–617  ·  view source on GitHub ↗
(cctagsPathStr string, cctagsPath []int16, v reflect.Value, name string, idx **[]int)

Source from the content-addressed store, hash-verified

601}
602
603func (dec *Decoder) tryToAddNewTag(cctagsPathStr string, cctagsPath []int16, v reflect.Value, name string, idx **[]int) {
604 dec.state.lock.Lock()
605 defer dec.state.lock.Unlock()
606 if *idx == nil {
607 *idx = dec.ctagsCache.FindOrAdd(cctagsPath)
608 }
609 if len(**idx) == 0 {
610 if sf, ok := fieldByTag(v.Type(), name); ok {
611 **idx = sf.Index
612 } else {
613 // Add tags path to the missing fields cache to avoid unique lock for those fields later
614 dec.ctagsCache.missing[cctagsPathStr] = struct{}{}
615 }
616 }
617}
618
619func (dec *Decoder) ResetSerializer() {
620 if dec.ser == nil {

Callers 1

decodeValueMethod · 0.95

Calls 5

fieldByTagFunction · 0.85
FindOrAddMethod · 0.80
TypeMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected