-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
routing: Implement GetValuesAsync #3720
Conversation
34d0e3d
to
dbd88b3
Compare
License: MIT Signed-off-by: Mildred Ki'Lya <mildred-git@mildred.fr>
dbd88b3
to
b297a2d
Compare
defer close(res) | ||
data, err := c.GetValue(ctx, key) | ||
if err != nil { | ||
log.Debugf("GetValuesAsync error: %v", err) |
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 really makes me think that the RecvdVal
should contain an error field.
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 LGTM. However we might consider how putting errors in the recvdVal struct would affect the flow of things (I really don't like ignoring errors like this encourages)
@Kubuxu do you think this looks good? Or should we push to make |
I took this approach with errors because another function did. But at first, my first idea was to return a second channel with possible errors. It's very easy to do and I don't mind updating my PR to match that or similar. |
@mildred could you return just a single channel, but have the type of the channel contain either a response or an error (like an option type)? Two channels cat get pretty tricky to deal with at times |
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.
(see other comment)
I started the change to make a response with an error built in, but then couldn't find this discussion any more. What's necessary to do that is to change go-libp2p-routing to add an error field to |
18e8c41
to
c561672
Compare
Updated the PR, see also dependent changes in libp2p/go-libp2p-kad-dht#49 and libp2p/go-libp2p-routing#7 |
License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub@mildred.fr>
c561672
to
f661847
Compare
I need to get to reviewing and merging the dependent PRs. Bumping this task to 0.4.8 |
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.
@whyrusleeping what do we want to do about this PR and connected PRs?
(cleaning out my Review queue).
@Kubuxu I definitely want this as part of the API. I think its really important for users of the DHT |
Replaced by #5232. |
1 similar comment
Replaced by #5232. |
For libp2p/go-libp2p-kad-dht#47