rs-ipfs / rust-ipfs

The InterPlanetary File System (IPFS), implemented in Rust.
Apache License 2.0
1.26k stars 163 forks source link

unixfs examples do not actually use IPFS #487

Open matthiasbeyer opened 2 years ago

matthiasbeyer commented 2 years ago

Hi,

so I was looking at the examples in the ipfs_unixfs subcrate and am wondering why the examples are not actually using ipfs... because I try to use them (the "add" example) as a blueprint for my "add" implementation for an app I am writing. I found that the blocks were not added to IPFS, so I assumed one just has to use the FileAdder and add the returned blocks to IPFS with Ipfs::put_block(), but it seems that this does not really work. The resulting IPFS entry is empty.

Maybe someone can help me there? :-) And sorry for asking so many questions here!

koivunej commented 2 years ago

sorry for asking so many questions here!

No worries, apologies if I have missed any of those.

So ipfs-unixfs doesn't depend on ipfs but attempts to provide a standalone thing which could be useful beyond this repository. However, the implementation is not finished and is missing HAMT sharded directory creation, and efficient lookups.

You can find an the http endpoint /add implementation here which is currently the only example that I can remember writing for the functionality. Similarly all of the http endpoints have been implemented first, then thought of how to move this into a useful looking library feature. add has not yet been "refactored", as you can see from the http api endpoint, it does quite a many different things, so doing all that or a useful subset which would still be useful in the http endpoint is something I didn't get to find last time working on this.

Please note that many features are missing or rarely work on the project at all. We've tried to make all easily decidable cases like too large unixfs directories error early but for network operations this is not possible.