[Enhancement] Bare hash wantlist #388
Description
It is entirely possible, especially as IPFS is not yet widely adopted that a peer may have a file, but does not know a corresponding IPFS url, because it just stores the full hash of the file in some file catalog(rather than a pointer to a magic DHT shard, as seems to be the case in bitswap).
To this end I think a peer should also be able to list want hashes to a connected peer.
Enquiry Setup
- A peer enquires to connected hosts about what form(s) of catalog hash they have (md5,sha1,sha512). [optional]
- The peer produces a bare hash wantlist of the form
(hash_type_multicodec,hash)
Peering Algorithm
On another peer
- Read wantlist of peer p
- Ask a
bare_wantlist_provider
if that file is on file ipfs add --nocopy <file>
if available- Notify peer p of:
- The corresponding ipfs url, or
- File Unavailable
Bare wantlist provider
A bare wantlist provider is a program registered with the ipfs daemon. Some configuration or environment variable will be set to its path, and accepted hash types.
The wantlist provider will be invocable in the form
cmdName <hashName>://<hash>
And shall print the path of the corresponding file, then exit 0
or
If the file is not found (or any other condition for which the peer does not want to serve the file) exit 1.