garden / tree

A multiplayer file system
https://thefiletree.com
European Union Public License 1.2
70 stars 23 forks source link

On-the-fly file type switching. #181

Closed espadrine closed 11 years ago

espadrine commented 11 years ago

@jankeromnes, want to take a stab at a review?

jankeromnes commented 11 years ago

If I understand correctly, calling file.writeMeta will call driver.dumpMeta and then resetType. This will then in turn call driver.loadMeta, try to guessType or default to binary (always overwriting the previous type), and then call file.writeMeta again if file.meta.type of file.meta['Last-Modified'] are undefined, restarting from the beginning.

Won't that recurse unnecessarily? Aren't we risking infinite callback loops? Why overwrite the file's type every time you write metadata to disk?

espadrine commented 11 years ago

Won't that recurse unnecessarily? Aren't we risking infinite callback loops? Why overwrite the file's type every time you write metadata to disk?

From what you said, we'll always end up with a file.meta.type set, won't we? And it will be set once for every file anyway. Unless another program systematically resets the metadata file, it won't loop indefinitely.

espadrine commented 11 years ago

Great, thanks!