Skip to content

Commit

Permalink
[#109, #110] Eastwood linter fixes (@jafingerhut)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Nov 11, 2014
1 parent be17d5c commit c338f37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/taoensso/carmine.clj
Expand Up @@ -139,7 +139,7 @@

;;; Lua scripts

(defn- str-sha [x] (org.apache.commons.codec.digest.DigestUtils/shaHex (str x)))
(defn- str-sha [x] (org.apache.commons.codec.digest.DigestUtils/sha1Hex (str x)))
(def script-hash (memoize (fn [script] (str-sha script))))

(defn evalsha* "Like `evalsha` but automatically computes SHA1 hash for script."
Expand Down
10 changes: 6 additions & 4 deletions src/taoensso/carmine/protocol.clj
Expand Up @@ -42,14 +42,15 @@
^bytes [^String s] (.getBytes s "UTF-8"))

;;; Request delimiters
(def ^bytes bs-crlf (bytestring "\r\n"))
(def ^{:tag 'bytes} bs-crlf (bytestring "\r\n"))
(def ^:const ^Integer bs-* (int (first (bytestring "*"))))
(def ^:const ^Integer bs-$ (int (first (bytestring "$"))))

;; Carmine-only markers that'll be used _within_ bulk data to indicate that
;; the data requires special reply handling
(def ^bytes bs-bin (bytestring "\u0000<")) ; Binary data marker
(def ^bytes bs-clj (bytestring "\u0000>")) ; Frozen data marker
(def ^{:tag 'bytes} bs-bin (bytestring "\u0000<")) ; Binary data marker
(def ^{:tag 'bytes} bs-clj (bytestring "\u0000>")) ; Frozen data marker
(def ^{:tag 'bytes} bs-bin (bytestring "\u0000<"))

(defn- ensure-reserved-first-byte [^bytes ba]
(when (= (first ba) 0)
Expand Down Expand Up @@ -88,12 +89,13 @@
(defmacro ^:private send-$ [out] `(.write ~out bs-$))
(defmacro ^:private send-crlf [out] `(.write ~out bs-crlf 0 2))

(defn- send-requests [^BufferedOutputStream out requests]
(defn- send-requests
"Sends requests to Redis server using its byte string protocol:
*<no. of args> crlf
[$<size of arg N> crlf
<arg data> crlf ...]"
;; {:pre [(vector? requests)]}
[^BufferedOutputStream out requests]
(doseq [req-args requests]
(when (pos? (count req-args)) ; [] req is dummy req for `return`
(let [bs-args (:bytestring-req (meta req-args))]
Expand Down

0 comments on commit c338f37

Please sign in to comment.