MCPcopy
hub / github.com/rclone/rclone / Lookup

Method Lookup

cmd/mount/dir.go:75–99  ·  view source on GitHub ↗

Lookup looks up a specific entry in the receiver. Lookup should return a Node corresponding to the entry. If the name does not exist in the directory, Lookup should return ENOENT. Lookup need not to handle the names "." and "..".

(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse)

Source from the content-addressed store, hash-verified

73//
74// Lookup need not to handle the names "." and "..".
75func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fusefs.Node, err error) {
76 defer log.Trace(d, "name=%q", req.Name)("node=%+v, err=%v", &node, &err)
77 mnode, err := d.Dir.Stat(req.Name)
78 if err != nil {
79 return nil, translateError(err)
80 }
81 resp.EntryValid = time.Duration(d.fsys.opt.AttrTimeout)
82 // Check the mnode to see if it has a fuse Node cached
83 // We must return the same fuse nodes for vfs Nodes
84 node, ok := mnode.Sys().(fusefs.Node)
85 if ok {
86 return node, nil
87 }
88 switch x := mnode.(type) {
89 case *vfs.File:
90 node = &File{x, d.fsys}
91 case *vfs.Dir:
92 node = &Dir{x, d.fsys}
93 default:
94 panic("bad type")
95 }
96 // Cache the node for later
97 mnode.SetSys(node)
98 return node, nil
99}
100
101// Check interface satisfied
102var _ fusefs.HandleReadDirAller = (*Dir)(nil)

Callers 11

fieldsFunction · 0.45
ShowStatsFunction · 0.45
RunFunction · 0.45
lsf.goFile · 0.45
setAlternateFlagFunction · 0.45
ServeMethod · 0.45
SetListFormatMethod · 0.45
ItemsFunction · 0.45
installFlagFunction · 0.45
AddFlagsFromOptionsFunction · 0.45
SetFlagsFunction · 0.45

Calls 5

TraceFunction · 0.92
translateErrorFunction · 0.70
StatMethod · 0.65
SetSysMethod · 0.65
SysMethod · 0.45

Tested by

no test coverage detected