Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Use js-ipld for DAG API #738

Closed
vmx opened this issue Apr 12, 2018 · 4 comments · May be fixed by #755
Closed

Use js-ipld for DAG API #738

vmx opened this issue Apr 12, 2018 · 4 comments · May be fixed by #755

Comments

@vmx
Copy link
Contributor

vmx commented Apr 12, 2018

Basic support for the DAG API landed with #534.

Though not all formats are supported and you can't traverse through different types of formats. I.e. you couldn't follow a link from a dag-cbor node to a dag-pb node.

The solution is to use js-ipld instead of hard-coding the formats (currently dag-cbor and dag-pb).

Using js-ipld is not straight forward. The problem is that js-ipld needs a Block Service which in turn needs a Repository to work. But js-htt-api doesn't have the blocks available in the JS environment, but receives them manually over the HTTP API.

So I guess you would need a Block Service (or Repository) that uses the HTTP API to retrieve the blocks. But I leave the details to whoever will implement this.

@alanshaw
Copy link
Contributor

alanshaw commented May 1, 2018

If no-one else is working on this I'd like to have a stab at it. We need the DAG API to work properly for the IPLD Explorers to work with JS-IPFS.

I'm thinking create an IPLDResolver with a block service that uses an "API exchange" (a bitswap exchange that just uses the block API to retrieve blocks it doesn't have).

At least, from reading the commentary on #534 that seems to be the idea.

Any objections?

@alanshaw
Copy link
Contributor

alanshaw commented May 1, 2018

Is it as simple as this? I added IPLD to js-ipfs-api and it now dag.get git dags 😮

screen shot 2018-05-01 at 20 24 52

@alanshaw alanshaw self-assigned this May 2, 2018
@vmx
Copy link
Contributor Author

vmx commented May 2, 2018

No objections. If it's easy that's even better :)

@daviddias
Copy link
Contributor

Woot! Great work @alanshaw ❤️ Let's finish this feat convo up on #755

@ghost ghost removed the in progress label Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants