MCPcopy
hub / github.com/rclone/rclone / DirectoryFromOriginal

Function DirectoryFromOriginal

backend/cache/directory.go:59–79  ·  view source on GitHub ↗

DirectoryFromOriginal builds one from a generic fs.Directory

(ctx context.Context, f *Fs, d fs.Directory)

Source from the content-addressed store, hash-verified

57
58// DirectoryFromOriginal builds one from a generic fs.Directory
59func DirectoryFromOriginal(ctx context.Context, f *Fs, d fs.Directory) *Directory {
60 var cd *Directory
61 fullRemote := path.Join(f.Root(), d.Remote())
62
63 dir := cleanPath(path.Dir(fullRemote))
64 name := cleanPath(path.Base(fullRemote))
65 t := time.Now()
66 cd = &Directory{
67 Directory: d,
68 CacheFs: f,
69 Name: name,
70 Dir: dir,
71 CacheModTime: d.ModTime(ctx).UnixNano(),
72 CacheSize: d.Size(),
73 CacheItems: d.Items(),
74 CacheType: "Directory",
75 CacheTs: &t,
76 }
77
78 return cd
79}
80
81// Fs returns its FS info
82func (d *Directory) Fs() fs.Info {

Callers 2

ListMethod · 0.85
ListRMethod · 0.85

Calls 9

cleanPathFunction · 0.85
JoinMethod · 0.80
DirMethod · 0.80
BaseMethod · 0.80
RootMethod · 0.65
RemoteMethod · 0.65
ModTimeMethod · 0.65
SizeMethod · 0.65
ItemsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…