MCPcopy Index your code
hub / github.com/OpenListTeam/OpenList / removeDirectoryObject

Method removeDirectoryObject

internal/op/cache.go:69–84  ·  view source on GitHub ↗

remove object from dirCache. if it's a directory, remove all its children from dirCache too. if it's a file, remove its link from linkCache.

(storage driver.Driver, dirPath string, obj model.Obj)

Source from the content-addressed store, hash-verified

67// if it's a directory, remove all its children from dirCache too.
68// if it's a file, remove its link from linkCache.
69func (cm *CacheManager) removeDirectoryObject(storage driver.Driver, dirPath string, obj model.Obj) {
70 key := Key(storage, dirPath)
71 if !obj.IsDir() {
72 cm.linkCache.DeleteKey(stdpath.Join(key, obj.GetName()))
73 }
74
75 if storage.Config().NoCache {
76 return
77 }
78 if cache, exist := cm.dirCache.Get(key); exist {
79 if obj.IsDir() {
80 cm.deleteDirectoryTree(stdpath.Join(key, obj.GetName()))
81 }
82 cache.RemoveObject(obj.GetName())
83 }
84}
85
86// cache user data
87func (cm *CacheManager) SetUser(username string, user *model.User) {

Callers 1

RemoveFunction · 0.80

Calls 8

deleteDirectoryTreeMethod · 0.95
KeyFunction · 0.85
DeleteKeyMethod · 0.80
RemoveObjectMethod · 0.80
IsDirMethod · 0.65
GetNameMethod · 0.65
ConfigMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected