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

Function ReadGroupIdFile

x/file.go:166–186  ·  view source on GitHub ↗

ReadGroupIdFile reads the file at the given path and attempts to retrieve the group ID stored in it.

(pdir string)

Source from the content-addressed store, hash-verified

164// ReadGroupIdFile reads the file at the given path and attempts to retrieve the
165// group ID stored in it.
166func ReadGroupIdFile(pdir string) (uint32, error) {
167 path := filepath.Join(pdir, GroupIdFileName)
168 info, err := os.Stat(path)
169 if os.IsNotExist(err) {
170 return 0, nil
171 }
172 if info.IsDir() {
173 return 0, errors.Errorf("Group ID file at %s is a directory", path)
174 }
175
176 contents, err := os.ReadFile(path)
177 if err != nil {
178 return 0, err
179 }
180
181 groupId, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 0, 32)
182 if err != nil {
183 return 0, err
184 }
185 return uint32(groupId), nil
186}

Callers 4

runRestoreFunction · 0.92
runRestoreFunction · 0.92
runRestoreFunction · 0.92
InitServerStateFunction · 0.92

Calls 1

ErrorfMethod · 0.45

Tested by 3

runRestoreFunction · 0.74
runRestoreFunction · 0.74
runRestoreFunction · 0.74