1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

don't cache entire mfs tree on add finalize

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy
2016-08-01 16:53:45 -07:00
parent 33510a9a29
commit ac3f9aceb4
2 changed files with 9 additions and 0 deletions

View File

@ -231,6 +231,8 @@ func (adder *Adder) outputDirs(path string, fsn mfs.FSNode) error {
if err != nil { if err != nil {
return err return err
} }
fsn.Uncache(name)
} }
nd, err := fsn.GetNode() nd, err := fsn.GetNode()
if err != nil { if err != nil {

View File

@ -152,6 +152,13 @@ func (d *Directory) Child(name string) (FSNode, error) {
return d.childUnsync(name) return d.childUnsync(name)
} }
func (d *Directory) Uncache(name string) {
d.lock.Lock()
defer d.lock.Unlock()
delete(d.files, name)
delete(d.childDirs, name)
}
// childFromDag searches through this directories dag node for a child link // childFromDag searches through this directories dag node for a child link
// with the given name // with the given name
func (d *Directory) childFromDag(name string) (*dag.Node, error) { func (d *Directory) childFromDag(name string) (*dag.Node, error) {