Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implemented a tyrant-put command to do puts on servers

  • Loading branch information...
commit 371de375073ba62d8eac1358d0778717d53e7e5e 1 parent 87ce437
@Kobold authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 tyrant.clj
16 tyrant.clj
@@ -38,6 +38,20 @@
byte-count (.read stream buf)]
(take byte-count buf)))
+(defn tyrant-put
+ "Put a given key and value into a server running on localhost."
+ [key value]
+ (with-open [sock (Socket. "localhost" default-port)
+ in (.getInputStream sock)]
+ (send-bytes sock
+ [:byte 0xC8]
+ [:byte 0x10]
+ [:dword (count key)]
+ [:dword (count value)]
+ [:string key]
+ [:string value])
+ (inputstream-seq in)))
(defn tyrant-get
"Get a given tyrant key from a server running on localhost."
@@ -48,4 +62,4 @@
[:byte 0x30]
[:dword (count key)]
[:string key])
- (println (inputstream-seq in))))
+ (inputstream-seq in)))
Please sign in to comment.
Something went wrong with that request. Please try again.