@cryptotaxi247 / kubo / commits / ac3f9aceb

don't cache entire mfs tree on add finalize

License: MIT Signed-off-by: Jeromy <why@ipfs.io>

Jeromy committed Aug 1, 2016 at 16:53 UTC ac3f9aceb420cb51fba43016f736c69b96cc95c8
2 files changed +9
core/coreunix/add.go
+2
@@ -231,6 +231,8 @@ func (adder *Adder) outputDirs(path string, fsn mfs.FSNode) error {
231 if err != nil {
232 return err
233 }
234 +
235 + fsn.Uncache(name)
236 }
237 nd, err := fsn.GetNode()
238 if err != nil {
mfs/dir.go
+7
@@ -152,6 +152,13 @@ func (d *Directory) Child(name string) (FSNode, error) {
152 return d.childUnsync(name)
153 }
154
155 +func (d *Directory) Uncache(name string) {
156 + d.lock.Lock()
157 + defer d.lock.Unlock()
158 + delete(d.files, name)
159 + delete(d.childDirs, name)
160 +}
161 +
162 // childFromDag searches through this directories dag node for a child link
163 // with the given name
164 func (d *Directory) childFromDag(name string) (*dag.Node, error) {