Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Auto-delete corrupted content entries #83

Open
zkat opened this issue Apr 13, 2017 · 1 comment
Open

Auto-delete corrupted content entries #83

zkat opened this issue Apr 13, 2017 · 1 comment

Comments

@zkat
Copy link
Owner

zkat commented Apr 13, 2017

If we get an EINTEGRITY error while reading stuff from the cache, the cached data should be unlinked. There's no need to remove associated index entries, though.

This should be implementable entirely within lib/content/read.js, since that's the single interface for ever reading data out of the cache. Things should be removable before any errors are actually emitted through either the promise or stream interfaces.

That said, this "feature" might be a bad idea -- in exchange for automatically clearing out bad caches, we might be giving up the ability to debug integrity issues. I think this is ok, though, because cacache errs on the side of throwing things away, and without this change, users are left with the responsibility of figuring out and fixing cache issues. They really shouldn't have to.

@zkat
Copy link
Owner Author

zkat commented Apr 22, 2017

Updated idea: move+rename the file into a /corrupted-content-vX directory using the failed hash. Use the same structure as the content directory, and the same version number. This dir should be cleaned up as part of verify(), and when throwing EINTEGRITY errors, we should include the path to the corrupted data in the error object.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant