MCPcopy
hub / github.com/perkeep/perkeep / ReadDir

Method ReadDir

pkg/fs/rover.go:302–331  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

300}
301
302func (n *roFileVersionsDir) ReadDir(ctx context.Context) ([]fuse.Dirent, error) {
303 if err := n.populate(ctx); err != nil {
304 Logger.Println("populate:", err)
305 return nil, handleEIOorEINTR(err)
306 }
307 n.mu.Lock()
308 defer n.mu.Unlock()
309 var ents []fuse.Dirent
310 for name, childNode := range n.children {
311 var ino uint64
312 switch v := childNode.(type) {
313 case *roDir:
314 ino = v.permanode.Sum64()
315 case *roFile:
316 ino = v.permanode.Sum64()
317 default:
318 Logger.Printf("roFileVersionsDir.ReadDir: unknown child type %T", childNode)
319 }
320
321 // TODO: figure out what Dirent.Type means.
322 // fuse.go says "Type uint32 // ?"
323 dirent := fuse.Dirent{
324 Name: name,
325 Inode: ino,
326 }
327 Logger.Printf("roFileVersionsDir(%q) appending inode %x, %+v", n.fullPath(), dirent.Inode, dirent)
328 ents = append(ents, dirent)
329 }
330 return ents, nil
331}
332
333func (n *roFileVersionsDir) Lookup(ctx context.Context, name string) (ret fs.Node, err error) {
334 defer func() {

Callers

nothing calls this directly

Calls 8

populateMethod · 0.95
fullPathMethod · 0.95
handleEIOorEINTRFunction · 0.85
PrintlnMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
Sum64Method · 0.80
PrintfMethod · 0.80

Tested by

no test coverage detected