From cf43d4006de422e7ca796a7a47e6bd4ff834211a Mon Sep 17 00:00:00 2001 From: Jaidyn Levesque Date: Thu, 6 Jun 2019 23:07:49 -0500 Subject: [PATCH] Add diag calls. --- main.lisp | 33 +++++++++++++++++++++++++++++++-- package.lisp | 6 ++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/main.lisp b/main.lisp index 078e9aa..e09a26b 100644 --- a/main.lisp +++ b/main.lisp @@ -414,13 +414,13 @@ (ipfs-call "dht/get" `(("arg" ,key))) (gethash "Addrs" (car (gethash "Responses"result))))) -;; STRING [:BOOLEAN] → NIL || (NIL STRING) +;; STRING [:BOOLEAN] → NIL (defun dht-provide (key &key (recursive nil)) "Announce to the network that you're providing the given values. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-provide" (ipfs-call "dht/provide" `(("arg" ,key)("recursive" ,recursive)))) -;; STRING STRING → NIL || (NIL STRING) +;; STRING STRING → NIL (defun dht-put (key value) "Write a key-value pair to the routing system. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-put" @@ -436,6 +436,35 @@ +;; ————————————————————————————————————— +;; DIAG CALLS + +;; NIL → ALIST || (NIL STRING) +(defun diag-cmds () + "List commands run on this IPFS node. + /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-cmds" + (mapcar #'re-hash-table-alist (ipfs-call "diag/cmds" '()))) + +;; NIL → STRING +(defun diag-cmds-clear () + "Clear inactive requests from the log. + /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-cmds-clear" + (ipfs-call "diag/cmds/clear" '())) + +;; NUMBER → STRING +(defun diag-cmds-set-time (time) + "Set how long to keep inactive requests in the log. + /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-cmds-set-time" + (ipfs-call "diag/cmds/set-time" `(("arg" ,time)))) + +;; NIL → STRING +(defun diag-sys () + "Print system diagnostic info. + /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-sys" + (ipfs-call "diag/sys" '())) + + + ;; ————————————————————————————————————— ;; VERSION CALLS diff --git a/package.lisp b/package.lisp index 804cd16..213d204 100644 --- a/package.lisp +++ b/package.lisp @@ -56,6 +56,12 @@ :dht-put :dht-query + ;; diag calls + :diag-cmds + :diag-cmds-clear + :diag-cmds-set-time + :diag-sys + ;; version calls :version :version-deps))