-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to add raw blocks / raw leaves #853
Comments
Tracking it down: File Details:
Conclusion: It might be easy to modify python codebase ipfshttpclient to add that functionality. Something like |
Luckily, it was that easy. As of writing this, I made two edits to https://github.com/ProximaNova/py-ipfs-http-client which are seen at: Neither are pulled into the official ipfs-shipyard/py-ipfs-http-client repo. It may not make since for them to be accepted into that as add() can add data as raw blocks. add_bytes() couldn't do that until I made those edits, which makes sense for this project (oduwsdl/ipwb). Explaining both commits:
|
@ProximaNova Thanks for reporting and spearheading the issue w/ the library. What is the use case for ipwb to add raw blocks/leaves? I'm unfamiliar and will do some reading on them but did not want a response to fall through the cracks. Also pinging @ibnesayeed for his 2¢, as he might be a bit more familiar. |
Thanks for looking into this. Being able to store raw blocks of desired sizes has other potential benefits of sub-resource deduplication. This ability has been available in the JavaScript library for a while, but when we worked on this piece of code earlier, the Python library did not have such features, so we opted for the easy route that works for the proof-of-concept. Our next-generation decentralized web archiving system called IPARO (not implemented yet) has some discussions around storing slices of objects strategically for better storage optimization. That said, if the upstream library accepts your changes, we will be happy to see a PR in this repo to test the implications. |
ipwb currently cannot add data as raw blocks. Benefits of raw blocks: they are faster and use up less storage space.
Whenever ipwb adds something to ipfs it uses this python api: https://github.com/ipfs-shipyard/py-ipfs-http-client (ipfshttpclient). Documentation:
https://ipfs.ssi.eecc.de/ipfs/QmSfSEXrkYzsLz4adKJzVe9zj8dT8V6X9rkXdXCenV35pQ/docs/http_client_ref.html
Looking at this section:
https://ipfs.ssi.eecc.de/ipfs/QmSfSEXrkYzsLz4adKJzVe9zj8dT8V6X9rkXdXCenV35pQ/docs/http_client_ref.html#ipfshttpclient.Client.add_bytes
it says nothing about add_bytes() having an option to add raw blocks. Therefore, perhaps use a different thing which can add raw blocks, or modify the source code of that Python API to be able to do that.
ipfshttpclient/client/__init__.py
defines the add_bytes method/function. As I understand, ipfshttpclient is a wrapper or implementation that communicates with Kubo IPFS's core API. For example, that__init__.py
file sayswhich looks like an API call. Raw blocks normally look like this: https://gateway.pinata.cloud/ipfs/bafkreibr3eo4ryibk6yueswcgepfybw33nwngs4z4vmr4ck2ky43j7cn64 (starts with "bafk"). Kubo ipfs command to create it: "ipfs add --cid-version=1 setup.cfg".
The text was updated successfully, but these errors were encountered: