-
Notifications
You must be signed in to change notification settings - Fork 17
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: Sequential and Parallel Routers #58
Conversation
ae267ce
to
665ea8f
Compare
compsequential.go
Outdated
case <-ctx.Done(): | ||
return |
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.
If the context is cancelled this cancels the current router but then it continues w/ the rest of the routers, we probably ought to short-circuit the whole loop at this point to avoid kicking off a bunch of wasteful queries.
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.
hmm, that's tricky, because that context is the specific router context with the timeout, so maybe the next routers still have execution time.
d799146
to
f38160d
Compare
dccecff
to
8fd91c4
Compare
type ProvideManyRouter interface { | ||
ProvideMany(ctx context.Context, keys []multihash.Multihash) error | ||
Ready() bool | ||
} |
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.
This interface is duplicated in multiple places and is ultimately what we need to consume a router in Kubo, right? Is there a way to move this somewhere authoritative? Should this be in libp2p? Also does this need to be exported?
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.
I think it should be where routing.Routing interface is living. It is public to at least have one source of truth that can be used anywhere.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
8fd91c4
to
0c84fe9
Compare
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
!errors.Is(err, routing.ErrNotFound) && | ||
!router.IgnoreError { | ||
cancel() | ||
break |
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.
Do you think it makes sense to log these attempts and errors at info/debug level so that someone can debug what's happening? (if so, we can follow up with this in a separate PR)
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.
yep, it would make sense
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.
Looks good! I guess there two followups here:
- Add some logging so we can debug what's happening (errors, control flow, etc.)
- Look into moving ProvideManyRouter into the libp2p routing package
|
It closes #56