MCPcopy
hub / github.com/rclone/rclone / ForgetPath

Method ForgetPath

vfs/dir.go:307–318  ·  view source on GitHub ↗

ForgetPath clears the cache for itself and all subdirectories if they match the given path. The path is specified relative from the directory it is called from. The cache of the parent directory is marked as stale, but not cleared otherwise. It is not possible to traverse the directory tree upwards,

(relativePath string, entryType fs.EntryType)

Source from the content-addressed store, hash-verified

305// It is not possible to traverse the directory tree upwards, i.e.
306// you cannot clear the cache for the Dir's ancestors or siblings.
307func (d *Dir) ForgetPath(relativePath string, entryType fs.EntryType) {
308 defer log.Trace(d.path, "relativePath=%q, type=%v", relativePath, entryType)("")
309 d.mu.RLock()
310 absPath := path.Join(d.path, relativePath)
311 d.mu.RUnlock()
312 if absPath != "" {
313 d.invalidateDir(vfscommon.FindParent(absPath))
314 }
315 if entryType == fs.EntryDirectory {
316 d.forgetDirPath(relativePath)
317 }
318}
319
320// walk runs a function on all cached directories. It will be called
321// on a directory's children first.

Callers 3

rcForgetFunction · 0.80
TestDirForgetPathFunction · 0.80
doMountCommandFunction · 0.80

Calls 5

invalidateDirMethod · 0.95
forgetDirPathMethod · 0.95
TraceFunction · 0.92
FindParentFunction · 0.92
JoinMethod · 0.80

Tested by 1

TestDirForgetPathFunction · 0.64