Sync housekeeping

This commit is contained in:
Peter Taoussanis 2016-07-24 15:41:31 +07:00
parent e07ec91f41
commit a8faac734c
3 changed files with 20 additions and 18 deletions

View file

@ -15,7 +15,7 @@
:dependencies :dependencies
[[org.clojure/clojure "1.5.1"] [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.reader "0.10.0"] [org.clojure/tools.reader "0.10.0"]
[com.taoensso/encore "2.64.1"] [com.taoensso/encore "2.67.1"]
[org.iq80.snappy/snappy "0.4"] [org.iq80.snappy/snappy "0.4"]
[org.tukaani/xz "1.5"] [org.tukaani/xz "1.5"]
[net.jpountz.lz4/lz4 "1.3"]] [net.jpountz.lz4/lz4 "1.3"]]

View file

@ -20,8 +20,8 @@
LazySeq IRecord ISeq])) LazySeq IRecord ISeq]))
(if (vector? enc/encore-version) (if (vector? enc/encore-version)
(enc/assert-min-encore-version [2 52 1]) (enc/assert-min-encore-version [2 67 1])
(enc/assert-min-encore-version 2.52)) (enc/assert-min-encore-version 2.67))
(comment (comment
(set! *unchecked-math* :warn-on-boxed) (set! *unchecked-math* :warn-on-boxed)
@ -238,9 +238,9 @@
;; TODO Switch to thread-local proxies? ;; TODO Switch to thread-local proxies?
(enc/defonce* ^:dynamic *freeze-fallback* "(fn [data-output x]), nil => default" nil) (enc/defonce ^:dynamic *freeze-fallback* "(fn [data-output x]), nil => default" nil)
(enc/defonce* ^:dynamic *custom-readers* "{<hash-or-byte-id> (fn [data-input])}" nil) (enc/defonce ^:dynamic *custom-readers* "{<hash-or-byte-id> (fn [data-input])}" nil)
(enc/defonce* ^:dynamic *auto-freeze-compressor* (enc/defonce ^:dynamic *auto-freeze-compressor*
"(fn [byte-array])->compressor used by `(freeze <x> {:compressor :auto}), "(fn [byte-array])->compressor used by `(freeze <x> {:compressor :auto}),
nil => default" nil => default"
nil) nil)
@ -1553,5 +1553,6 @@
;;;; Deprecated ;;;; Deprecated
(enc/defonce* ^:dynamic *final-freeze-fallback* "DEPRECATED" nil) (enc/deprecated
(def freeze-fallback-as-str "DEPRECATED" write-unfreezable) (enc/defonce ^:dynamic *final-freeze-fallback* "DEPRECATED" nil)
(def freeze-fallback-as-str "DEPRECATED" write-unfreezable))

View file

@ -8,7 +8,8 @@
;; Unfortunately the only ~reliable way we can tell if something's ;; Unfortunately the only ~reliable way we can tell if something's
;; really serializable/readable is to actually try a full roundtrip. ;; really serializable/readable is to actually try a full roundtrip.
(defn- memoize-type-test [test-fn] (let [swap-cache! @#'enc/-swap-cache!] ; TODO Public with newer Encore
(defn- memoize-type-test [test-fn]
(let [cache (atom {})] ; {<type> <type-okay?>} (let [cache (atom {})] ; {<type> <type-okay?>}
(fn [x] (fn [x]
(let [t (type x) (let [t (type x)
@ -16,8 +17,8 @@
cacheable? (not (re-find #"__\d+" (str t))) ; gensym form cacheable? (not (re-find #"__\d+" (str t))) ; gensym form
test (fn [] (try (test-fn x) (catch Exception _ false)))] test (fn [] (try (test-fn x) (catch Exception _ false)))]
(if cacheable? (if cacheable?
@(enc/swap-val! cache t #(if % % (delay (test)))) @(swap-cache! cache t #(if % % (delay (test))))
(test)))))) (test)))))))
(def readable? (memoize-type-test (fn [x] (-> x enc/pr-edn enc/read-edn) true))) (def readable? (memoize-type-test (fn [x] (-> x enc/pr-edn enc/read-edn) true)))
(def serializable? (def serializable?