Skip to content
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

feat: resolve the retrieval provider using IPNI #51

Merged
merged 10 commits into from
Feb 1, 2024
Merged

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Jan 29, 2024

  • refactor: introduce executeRetrievalCheck
  • feat: query the indexer
  • deps: add deno-varint
  • refactor: move deno-encoding-hex.js to vendored.js
  • feat: use provider advertised in IPNI records

Links:

@bajtos bajtos requested a review from juliangruber January 29, 2024 16:08
@bajtos
Copy link
Member Author

bajtos commented Jan 29, 2024

A very early version. The code seems to work well, but I'll have to clean it up and add some tests.

@juliangruber Feedback is welcome 🙏🏻

Signed-off-by: Miroslav Bajtoš <[email protected]>
deps.ts Outdated Show resolved Hide resolved
lib/spark.js Outdated Show resolved Hide resolved
@bajtos
Copy link
Member Author

bajtos commented Jan 31, 2024

Refactored and added tests.

Example console logs for advertised CID:

Querying IPNI to find retrieval providers for bafybeidf6pylxmpcv4mzoehiexeb3576onfstpw5wfccldx4zfyuevgs74
IPNI returned 10 provider results
Fetching: ipfs://bafybeidf6pylxmpcv4mzoehiexeb3576onfstpw5wfccldx4zfyuevgs74?dag-scope=block&protocols=http&providers=%2Fdns%2Ff01199430.datasetcreators.com%2Ftcp%2F80%2Fhttp
Retrieval failed with status code 502: no candidates found

Example logs for CID not advertised:

Querying IPNI to find retrieval providers for QmcAW55tTH4DrPqMqsmTvCic1c4ZZ4mhSBwpg3pj5PNJRd
IPNI query failed, HTTP response: 404

Example logs when there is only Graphsync advertised:

Querying IPNI to find retrieval providers for bafybeif5y6gfc7e4lmj3hnoebgr3oyz2mxvd7ns7nuoff7qvdphirqbcbe
IPNI returned 6 provider results
HTTP protocol is not advertised, falling back to Graphsync.

@bajtos bajtos marked this pull request as ready for review January 31, 2024 16:43
@bajtos bajtos requested a review from juliangruber January 31, 2024 16:43
@bajtos
Copy link
Member Author

bajtos commented Feb 1, 2024

@juliangruber do you have any comments regarding the proposed code changes?

Copy link
Member

@juliangruber juliangruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me :)

@bajtos bajtos merged commit 038d4b7 into main Feb 1, 2024
1 check passed
@bajtos bajtos deleted the feat-ipni-query branch February 1, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ done
Development

Successfully merging this pull request may close these issues.

2 participants