hyperdrive
hyperdrive copied to clipboard
readdir() w/recursive=true needs to handle mount-cycles and large mount-graphs
Currently if you have a "mount cycle" (2 drives that mount each other) the readdir() call with {recursive: true} will enter an endless loop.
Even without a cycle, mount-graphs have the potential to become so large that recursion is not feasible. (E.g. Beaker's use of mounts for the social graph could cause a recursive readdir to iterate the "strong set.")
Ways we can solve this:
- Add a
depthparameter to limit the number of recursions into subfolders - Add a
mountDepthparameter to limit the number of recursions into mounts - Don't recurse into mounts at all (aka
mountDepthis always0)
Ways we can't solve this:
- Track mounts and break cycles. This would solve the cycle problem but large mount-graphs would still be an issue.
I personally prefer either the mountDepth option or not recursing into mounts.
Is this related to https://github.com/mafintosh/hyperdrive/issues/258?
It doesn't look like it, the test case in #257 doesn't use recursive readdir