 
 (defn- when-done [future-to-watch function-to-call]
   (future (function-to-call @future-to-watch)))
+
+(defmacro http-perform
+  ([body base]
+     `(parse-string (:body (~body (str ~base)))))
+  ([body base path]
+     `(parse-string (:body (~body (str ~base ~path))))))
 
 (defn connect!
   ([etcd-server-host] (connect! etcd-server-host 4001 7001))

  [key & {:keys [recursive]}]
  (let [url (str (base-url) "/keys/" key "?recursive=" recursive)]
    (map #(assoc {} :key (clojure.core/get % "key") :value (clojure.core/get % "value"))
         (clojure.core/get-in (parse-string (:body (client/get url ))) ["node" "nodes"]))))

(defn list-in-order
  "Lists the content of a directory recursively and in order"

(defn stats
  "Leader stats"
  []
  (http-perform client/get (base-url) "/stats/leader"))

(defn self-stats
  "Self Stats"
  []
  (http-perform client/get (base-url) "/stats/self"))

(defn store-stats
  "Store stats"
  []
  (http-perform client/get (base-url) "/stats/store"))

(defn machines
  "Machines"
  []
  (http-perform client/get (admin-base-url) "/admin/machines"))

(defn config
  "Gets the config"
  []
  (http-perform client/get (admin-base-url) "/admin/config"))
