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

Added Group dht #44

Merged
merged 5 commits into from
Apr 19, 2016
Merged

Added Group dht #44

merged 5 commits into from
Apr 19, 2016

Conversation

RichardLitt
Copy link
Contributor

Noted two main bugs:

- [ ] While verbose is specified in the HTTP API and is used in the HTTP request,
it returns no extra information in the ndjson response.

  • An invalid or empty key returns the same response as a normal one.


FindProviders will return a list of peers who are able to provide the value requested.

#### Bugs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe called it Known Bugs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally, these should be solved before this is actually merged.

Copy link
Collaborator

Choose a reason for hiding this comment

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

then ignore me :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Any issue on go-ipfs to track this bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a real bug.

@dignifiedquire
Copy link
Collaborator

Needs rebase

@RichardLitt
Copy link
Contributor Author

I accidentally rebased on top of #42. :|

@daviddias
Copy link
Contributor

While verbose is specified in the HTTP API and is used in the HTTP request, it returns no extra information in the ndjson response.

Seems like something that was deprecated

An invalid or empty key returns the same response as a normal one.

In which case:

    ipfs dht query <peerID>...    - Run a 'findClosestPeers' query through the DHT.
    ipfs dht findprovs <key>...   - Run a 'FindProviders' query through the DHT.
    ipfs dht findpeer <peerID>... - Run a 'FindPeer' query through the DHT.
    ipfs dht get <key>...         - Run a 'GetValue' query through the DHT.
    ipfs dht put <key> <value>    - Run a 'PutValue' query through the DHT.

@RichardLitt
Copy link
Contributor Author

@whyrusleeping I'm looking at the code, and I honestly can't see how the ipfs dht findprovs <key> is anything similar to what is returned by the API. Moreover, verbose seems to be only used in conditionals in the Gocode to print stuff using Fprintf; am I right in thinking that this isn't caught by the marshaller // converted into JSON?

@RichardLitt
Copy link
Contributor Author

@RichardLitt Marshallers are client side. Remove verbose.

@RichardLitt
Copy link
Contributor Author

Should be good to go. Not sure if this is how these are actually supposed to look, but seems to work fine.

Noted two main bugs:

- [ ]  While `verbose` is specified in the HTTP API and is used in the HTTP request,
it returns no extra information in the ndjson response.
- [ ] An invalid or empty key returns the same response as a normal one.

## findprovs
This command can't be called directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this exactly mean? Example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean you can't call curl -i "http://localhost:5001/api/v0/dht". It makes sense with context, and I've used this notation elsewhere. I can change it to be more blatant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Specifically, if you try:

🐕  curl -i "http://localhost:5001/api/v0/dht"
HTTP/1.1 400 Bad Request
Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Content-Type: application/json
Server: go-ipfs/0.4.1-dev
Trailer: X-Stream-Error
Date: Tue, 19 Apr 2016 14:53:01 GMT
Transfer-Encoding: chunked

{"Message":"This command can't be called directly. Try one of its subcommands.","Code":1}

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. /dht isn't an endpoint, that is ok :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Just pointing that out for the user.


+ Response 200

The response has been truncated to a single ndjson object, as the responses are streamed.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@daviddias
Copy link
Contributor

LGTM :)

@RichardLitt RichardLitt merged commit f36b363 into master Apr 19, 2016
@RichardLitt RichardLitt deleted the feature/dht branch April 19, 2016 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants