MCPcopy
hub / github.com/dgraph-io/badger / getUnlockCallback

Method getUnlockCallback

value.go:1578–1587  ·  view source on GitHub ↗

getUnlockCallback will returns a function which unlock the logfile if the logfile is mmaped. otherwise, it unlock the logfile and return nil.

(lf *logFile)

Source from the content-addressed store, hash-verified

1576// getUnlockCallback will returns a function which unlock the logfile if the logfile is mmaped.
1577// otherwise, it unlock the logfile and return nil.
1578func (vlog *valueLog) getUnlockCallback(lf *logFile) func() {
1579 if lf == nil {
1580 return nil
1581 }
1582 if vlog.opt.ValueLogLoadingMode == options.MemoryMap {
1583 return lf.lock.RUnlock
1584 }
1585 lf.lock.RUnlock()
1586 return nil
1587}
1588
1589// readValueBytes return vlog entry slice and read locked log file. Caller should take care of
1590// logFile unlocking.

Callers 4

ReadMethod · 0.95
doRunGCMethod · 0.95
TestValueBasicFunction · 0.80
BenchmarkReadWriteFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestValueBasicFunction · 0.64
BenchmarkReadWriteFunction · 0.64