-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
ipfs add --to-files=/path/in/mfs #8504
Comments
I'd like to pile on saying that this is an important feature. The main reason that I want this is because the cid=$(ipfs add -Q foobar)
ipfs files cp /ipfs/$cid /test/foobar
ipfs pin rm /ipfs/$cid However if that CID was already pinned I just accidentally removed it! If this was "temporary" I might then remove The work around is of course to never use IPFS pins, but sometimes you do and don't want to have them accidentally getting deleted. Adding this API would allow avoiding the pinning API entirely which is highly valuable. |
#8637 revealed that we would have to duplicate a lot of code that we are not happy about with in the first place. This is not super urgent, I propose we do this in a way that will be easy to maintain. Lets adjust the scope here, somehow. Potential paths forward:
Realistically, ETA of (A) and (C) is unknown. I think adding Proposed solution:
|
@lidel : now that the scope is clarified, do you need to be the one to do this, or is this up for grabs? |
Up for grabs! |
The copy-option variant seems sane. |
@lidel Could you list here (in pseudo-code if easier) the sharness command tests you'd want for this? |
Part of a bigger effort in #8264. |
Problem
There is a UX gap in our MFS API where users importing data to IPFS via
ipfs add
andipfs files write
get different CIDs due to different way chunks are assembled into a DAG (balanced vs trickle). Details in issues linked below.While we hoped the problem will get solved by "/api/v1" it did not happen, and we are still confusing users just like we did in 2016:
2022:
2021:
2018: Upload via WebUI (ipfs.files.write --create) produces different hash than CLI (ipfs.add) ipfs-webui#676
2016: "ipfs add" and "ipfs files write" commands returns different hashes ipfs-inactive/support#45
Unpacking UX challenges
If a user wants to add data to MFS directly, they need to glue two (or more) commands together:
ipfs add
by default creates a low-level pin which keeps data around even when the file is removed from MFS. This behavior is usually NOT what MFS users want, so they useipfs files write
and get different CID of trickle DAG, and can't benefit from common CID.One could either do
ipfs add
with--pin=false
(risky when GC is enabled) or remove low-level Pin afterfiles cp
is successful (still problematic, in case the CID was pinned for different reasons)Either way, asking users to execute two or more commands is not nice. What users want and asked for is essentially a better API, an atomic
ipfs files cp /ipfs/$(ipfs add -Q --pin=false test.mp4) /test/test.mp4
but with GC safety.Proposed solution:
ipfs files add
Add porcelain command that executes
ipfs add --pin=false && ipfs files cp
in atomic fashion that is safe from GC.Main characteristics:
ipfs files write
but without ability to append data – instead, allow recursive import of entire dirs likeipfs add -r
ipfs add
The text was updated successfully, but these errors were encountered: