DHT-FINDPROVS fails (several issues...) #2
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: jadedctrl/cl-ipfs-api2#2
Ŝarĝante…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There are several problems, aside from the obvious one of
DHT-FINDPROVS
not working. Let's start by issuing the undrlying API call more directly:The returned hashtable consists of:
Addrs
, which does not exist. Perhaps "ID" is more appropriate...num-providers
is 20 (I tried both as a string "20" and number 20). The CLI command returns a whole bunch of these...What happened here?
On a hunch I stuck in a
(format t "~A" (flexi-streams:octets-to-string result))
to output the result of the api call, and it returns a shitload of stuff...YASON:PARSE only parses the first JSON expression...
Gah.
YASON:PARSE ignores all but the first response. To be honest, the responses should have been encoded as an array...
IPFS> (yason:parse "{ \"a\" : 2 } { up-yours} ")
I don't feel like preparsing the input to yason:parse (it would require comma separators and surrounding braces).
A first whack. I convert the string to a stream, then go into a loop asking YASON to parse until EOF... Oh, and YASON can deliver an ALIST without an extra step of going to a hashtable and back to an ALIST...
Now the output is complete (and a bit long-winded):
I used your ipfs-call as a basis for this last commit (
f185501
). #'dht-findprovs (among others) should be working just fine now. Thanks a lot for the basis.Yes, it returns all the responses, although it is somewhat verbose.
I don't have enough experience with IPFS to make any serious suggestions, but the empty "Addrs", "ID" and "Extra" fields could be filtered somehow... The inconsistency of "Addrs" list with nothing following and "ID" and "Extra" as conses is also irksome. API bindings always turn into a headache once you start lispifying them...
Do you have any examples of calls with those empty fields? They sound annoying, I'll try filtering them out.
In the post above, things like
Ahh, I see what you mean now, thanks. I'll work on it.
Aint that the truth.