MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / replaceHashed

Method replaceHashed

cmd/data-usage-cache.go:535–545  ·  view source on GitHub ↗

replaceHashed add or replaces an entry to the cache based on its hash. If a parent is specified it will be added to that if not already there. If the parent does not exist, it will be added.

(hash dataUsageHash, parent *dataUsageHash, e dataUsageEntry)

Source from the content-addressed store, hash-verified

533// If a parent is specified it will be added to that if not already there.
534// If the parent does not exist, it will be added.
535func (d *dataUsageCache) replaceHashed(hash dataUsageHash, parent *dataUsageHash, e dataUsageEntry) {
536 if d.Cache == nil {
537 d.Cache = make(map[string]dataUsageEntry, 100)
538 }
539 d.Cache[hash.Key()] = e
540 if parent != nil {
541 p := d.Cache[parent.Key()]
542 p.addChild(hash)
543 d.Cache[parent.Key()] = p
544 }
545}
546
547// copyWithChildren will copy entry with hash from src if it exists along with any children.
548// If a parent is specified it will be added to that if not already there.

Callers 3

reduceChildrenOfMethod · 0.95
mergeMethod · 0.95
scanFolderMethod · 0.80

Calls 2

addChildMethod · 0.80
KeyMethod · 0.45

Tested by

no test coverage detected