Closed cmadh closed 6 years ago
I'm running into the same issue. Adding a directory is working with ipfs-cluster-ctl
and what I can tell from a tcpdump is that ipfs-cluster-ctl add -r <dir>
performs a single request to api/v0/add?recursive=true
but this api performs multiple adds and then a api/v0/object/put
. I think this API should rather do it the same way as the official tools?
I've never encountered IPFS-Cluster before. Can you point me to documentation?
How is a directory added to IPFS-Cluster?
Documentation is on cluster.ipfs.io. It is basically a service on top of ipfs with a http-proxy that catches requests documented here and performs them for all nodes in the cluster. It aims to mimic responses to the ones by ipfs-http-api. So there should be no difference in using them. However - as you can tell from the documentation - the endpoint /object/put
is directly passed to the ipfs-api and not distributed by ipfs-cluster. Therefore the content is not available/added on all nodes. I tested the official ipfs/js-ipfs-api and it seems to upload directories by a single request to /add?recursive=true
-endpoint and works fine with ipfs-cluster.
seems like js-ipfs-api is doing a single Multipart-Post conatining all files, to api/v0/add?. Docs here: https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/FILES.md#filesadd and here: https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/FILES.md#filesaddpullstream Here is the multipart-wrapper: https://github.com/ipfs/js-ipfs-api/blob/master/src/utils/send-files-stream.js
@cmadh and @kthamm thanks for the information.
From my brief reading of ipfs-cluster
it appears that it "emulates" the HTTP-API for a group of peers.
I think it should support api/v0/object/put
and also api/v0/dag/put
. Could you raise an issue there?
PS: ipfs-cluster
should also support api/v0/block/put
.
When adding a directory to an IPFS-Cluster, the DagNode is not added to the Peers. Only to the connected Api-Host. Endpoints of ipfs and ipfs-cluster differ. api/v0/add/ works on both, so each file is correctly added and pinned, the directory not. api/v0/object/put is not distributed by the ipfs-cluster.