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

Method deleteLogFile

value.go:782–799  ·  view source on GitHub ↗
(lf *logFile)

Source from the content-addressed store, hash-verified

780}
781
782func (vlog *valueLog) deleteLogFile(lf *logFile) error {
783 if lf == nil {
784 return nil
785 }
786 lf.lock.Lock()
787 defer lf.lock.Unlock()
788
789 path := vlog.fpath(lf.fid)
790 if err := lf.munmap(); err != nil {
791 _ = lf.fd.Close()
792 return err
793 }
794 lf.fmap = nil
795 if err := lf.fd.Close(); err != nil {
796 return err
797 }
798 return os.Remove(path)
799}
800
801func (vlog *valueLog) dropAll() (int, error) {
802 // If db is opened in InMemory mode, we don't need to do anything since there are no vlog files.

Callers 3

rewriteMethod · 0.95
decrIteratorCountMethod · 0.95
dropAllMethod · 0.95

Calls 3

fpathMethod · 0.95
munmapMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected