You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides acting as a cache for relatively slow WasmFS backends, the dcache also
serves the critical purpose of ensuring that file identities are stable, i.e.
that each `File` object corresponds 1:1 to an underlying file. Maintaining this
property is critical because a large number of subtle bugs pop up without it.
For example, if a single file is represented by two `File` objects, then
removing it will only clear the parent pointer of one of the objects, leaving
the other in an inconsistent state.
However, sometimes the dcache can introduce more problems than it solves. For
example, in a hypothetical case-insensitive backend, the dcache would
incorrectly accumulate multiple entries with different capitalizations
corresponding to the same underlying file. In other cases, such as for the
in-memory backend, the dcache is superfluous because the backend already ensures
that files correspond 1:1 to `File` objects.
For these exceptional cases, provide a new virtual directory method,
`maintainsFileIdentity`, that allows backends to opt out of using the dcache and
handle all directory lookups themselves. Opting out comes with a few additional
responsibilities that are documented in file.h.
0 commit comments