-
Notifications
You must be signed in to change notification settings - Fork 18
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
HTTP protocol #204
HTTP protocol #204
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## feat/http #204 +/- ##
=============================================
+ Coverage 68.16% 70.43% +2.27%
=============================================
Files 63 64 +1
Lines 5443 5496 +53
=============================================
+ Hits 3710 3871 +161
+ Misses 1533 1409 -124
- Partials 200 216 +16
|
|
I'm pivoting here a little, refactoring the graphsync retriever so we can share the majority of the code between the two retrievers since the primary flow that we need is the same but the actual retrieving is different. In fact, it's almost close enough that you could just replace the "client" and they'd be the same, but not quite. But the whole mechanics of managing the parallel fetches, coordinating them, even selecting which one to next (as per #197) is very close and I'm finding myself copying and pasting a lot of code to bring this up to scratch already. |
Pushed a new update - my second (but very rough) try and trying to share logic between the graphsyncretriever and the http one. My initial attempt got too messy, trying to make an asbtract shared type that could be extended by two different retrievers. So my new tack was to just flesh out the graphsyncretriever more so it can serve both protocols, just with a different constructor for each. I'l try and disentangle it more (the The flow is basically the same between the two, with these differences:
|
Refactored this to a form that I don't hate and I think deals with the concerns quite well.
So now, The We still have the weirdness about what does a "Connect" mean for HTTP, but that question is separate to this abstraction and we need to answer that at some point. For now I'm still going with "start a request from every candidate as soon as we get them" and then "read the body from one candidate at a time until we get what we need". |
Aaaaand it lives. Working unit test added, so far just a simple single peer fetch, with a mocked http Client so it doesn't touch a server, just gets the bytes of a CAR and we expect to get the same blocks into our client LinkSystem in the same order. See httpretriever_test.go. In theory, if you were to compile a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very exciting!
I tested this branch against https://freeway.dag.haus and cid+path works as does The only minor snag i hit was
More here: storacha/freeway#34 (comment) |
i wonder if you can use the same p2p identity as eipfs for now? i suspect the http transport client is validating that against anything at the moment |
If you want to run any tests against freeway, anything recently uploaded to web3.storage or via the new w3up api (cli here) should be available via https://freeway.dag.haus ... but it's dag root only. fetching via non-root block cid isn't supported via that gateway yet. |
@willscott that's what i did in storacha/freeway#34 (comment) (it works) |
Sorry, have tuned out notifications for a few days, catching up on some backlog.
This is because we're heavily peer ID centric in the Lassie codebase. You can just stick a random peer ID on the end of your multiaddr for Mainly we use that for internal disambiguation between parallel fetches (only relevant for |
f6e8366
to
a8cc6f8
Compare
based on bitswap unit test framework
* too-detailed http testing, will remove this in favour of graphsync style testing.
So the tests are complete-enough for now, there's not much more I can test for this basic functionality. All the most interesting stuff will come with #195. So I'm going to merge this into @olizilla I should have the basics of #195 in place in the next few days, it's when things might get more interesting because right now, using lassie on this branch is only really testing that you have an HTTP endpoint that responds to a certain path string with a valid CAR, and that's it. We don't care whether it's a v1 or v2, what it says its roots are, or even what, or how many, blocks are in it. #193 will bring in all the strictness we need according to ipfs/specs#402 and where discrepancies or deficiencies in implementations will become more obvious. |
This is branching from
feat/http
which is in #193; using this to make my specific revisions. Working toward #195.Initial changes:
RetrievalRequest
andCarScope
themselves are used to figure out which selector (GetSelector()
), what the path & querystring are for the HTTP request (GetUrlPath()
- which canerror
),CarScope#TerminalSelectorSpec()
to help with selector building andCarScope#AcceptHeader()
to generate the appropriateAccept
for that scope.I'll continue to keep notes in here as I go.