-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
ipfs add --to-files=/path/in/mfs #8504
Copy link
Copy link
Closed
Labels
exp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulkind/enhancementA net-new feature or improvement to an existing featureA net-new feature or improvement to an existing featureneed/triageNeeds initial labeling and prioritizationNeeds initial labeling and prioritizationtopic/apiTopic apiTopic apitopic/filesTopic filesTopic files
Milestone
Metadata
Metadata
Assignees
Labels
exp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulkind/enhancementA net-new feature or improvement to an existing featureA net-new feature or improvement to an existing featureneed/triageNeeds initial labeling and prioritizationNeeds initial labeling and prioritizationtopic/apiTopic apiTopic apitopic/filesTopic filesTopic files
Problem
There is a UX gap in our MFS API where users importing data to IPFS via
ipfs addandipfs files writeget 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 addby 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 writeand get different CID of trickle DAG, and can't benefit from common CID.One could either do
ipfs addwith--pin=false(risky when GC is enabled) or remove low-level Pin afterfiles cpis 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.mp4but with GC safety.Proposed solution:
ipfs files addAdd porcelain command that executes
ipfs add --pin=false && ipfs files cpin atomic fashion that is safe from GC.Main characteristics:
ipfs files writebut without ability to append data – instead, allow recursive import of entire dirs likeipfs add -ripfs add