Switch precache to better locality check
Right now we list all local CIDs via ipfs refs local and its not efficient to do on a big repo:
https://github.com/ipfs-shipyard/ipfs-companion/blob/793bd6cdbe804f611ed42f7dd32c6fb8d9d224b8/add-on/src/lib/precache.js#L36-L40
Idea A
As noted here we could improve inRepo check and run regular ipfs refs -r --offline if there was no error that means the entire DAG is present in local repo.
Caveat: --offline works only in go-ipfs CLI, missing from JS API does not https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/REFS.md#ipfsrefslocaloptions
Idea B
below works in go-ipfs, showing % of local vs remote
ipfs files stat --with-local --size /ipfs/bafybeigkbbjnltbd4ewfj7elajsbnjwinyk6tiilczkqsibf3o7dcr6nn4
Idea C
ipfs block stat --offline <cid> will return error if CID is not already present in the datastore
TODO: check if implemented in js-ipfs and updated this forum thread for visibility.