MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / newMetaFile

Function newMetaFile

raftwal/meta.go:85–95  ·  view source on GitHub ↗

newMetaFile opens the meta file in the given directory.

(dir string)

Source from the content-addressed store, hash-verified

83
84// newMetaFile opens the meta file in the given directory.
85func newMetaFile(dir string) (*metaFile, error) {
86 fname := filepath.Join(dir, metaName)
87 // Open the file in read-write mode and creates it if it doesn't exist.
88 mf, err := z.OpenMmapFile(fname, os.O_RDWR|os.O_CREATE, metaFileSize)
89 if err == z.NewFile {
90 z.ZeroOut(mf.Data, 0, snapshotOffset+4)
91 } else if err != nil {
92 return nil, errors.Wrapf(err, "unable to open meta file")
93 }
94 return &metaFile{MmapFile: mf}, nil
95}
96
97func (m *metaFile) bufAt(info MetaInfo) []byte {
98 pos := getOffset(info)

Callers 2

InitEncryptedFunction · 0.85
TestMetaFileFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestMetaFileFunction · 0.68