Misc housekeeping
This commit is contained in:
parent
c4251fb39f
commit
9cac0afb98
2 changed files with 10 additions and 12 deletions
|
|
@ -35,8 +35,6 @@
|
|||
|
||||
;;;; TODO
|
||||
;; - Performance would benefit from ^:static support / direct linking / etc.
|
||||
;; - Auto cache keywords? When map keys? Configurable? Per-map
|
||||
;; (`cache-keys`)? Just rely on compression?
|
||||
|
||||
;;;; Nippy data format
|
||||
;; * 4-byte header (Nippy v2.x+) (may be disabled but incl. by default) [1]
|
||||
|
|
@ -282,10 +280,6 @@
|
|||
|
||||
(enc/defonce ^:dynamic *incl-metadata?* "Include metadata when freezing/thawing?" true)
|
||||
|
||||
(defn set-freeze-fallback! [x] (alter-var-root #'*freeze-fallback* (constantly x)))
|
||||
(defn set-auto-freeze-compressor! [x] (alter-var-root #'*auto-freeze-compressor* (constantly x)))
|
||||
(defn swap-custom-readers! [f] (alter-var-root #'*custom-readers* f))
|
||||
|
||||
;;;; Java Serializable config
|
||||
;; Unfortunately quite a bit of complexity to do this safely
|
||||
|
||||
|
|
@ -1829,7 +1823,7 @@
|
|||
(when (contains? *custom-readers* ~(coerce-custom-type-id custom-type-id))
|
||||
(println (str "Warning: resetting Nippy thaw for custom type with id: "
|
||||
~custom-type-id)))
|
||||
(swap-custom-readers!
|
||||
(alter-var-root #'*custom-readers*
|
||||
(fn [m#]
|
||||
(assoc m#
|
||||
~(coerce-custom-type-id custom-type-id)
|
||||
|
|
@ -1846,9 +1840,9 @@
|
|||
;;;; Stress data
|
||||
|
||||
(defrecord StressRecord [data])
|
||||
(deftype StressType [data]
|
||||
Object
|
||||
(equals [a b] (= (.-data a) (.-data ^StressType b))))
|
||||
(deftype StressType [data]
|
||||
Object (equals [a b] (= (.-data a) (.-data ^StressType b))))
|
||||
|
||||
(def stress-data "Reference data used for tests & benchmarks"
|
||||
{:bytes (byte-array [(byte 1) (byte 2) (byte 3)])
|
||||
:nil nil
|
||||
|
|
@ -2010,4 +2004,8 @@
|
|||
|
||||
;;;; Deprecated
|
||||
|
||||
(enc/deprecated (def freeze-fallback-as-str "DEPRECATED" write-unfreezable))
|
||||
(enc/deprecated
|
||||
(def freeze-fallback-as-str "DEPRECATED, use `write-unfreezable`" write-unfreezable)
|
||||
(defn set-freeze-fallback! "DEPRECATED, just use `alter-var-root`" [x] (alter-var-root #'*freeze-fallback* (constantly x)))
|
||||
(defn set-auto-freeze-compressor! "DEPRECATED, just use `alter-var-root`" [x] (alter-var-root #'*auto-freeze-compressor* (constantly x)))
|
||||
(defn swap-custom-readers! "DEPRECATED, just use `alter-var-root`" [f] (alter-var-root #'*custom-readers* f)))
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
(deftest _types
|
||||
;;; Extend to custom Type
|
||||
(is (thrown? Exception ; No thaw extension yet
|
||||
(do (nippy/swap-custom-readers! (constantly {}))
|
||||
(do (alter-var-root #'nippy/*custom-readers* (constantly {}))
|
||||
(nippy/extend-freeze MyType 1 [x s] (.writeUTF s (.data x)))
|
||||
(thaw (freeze (MyType. "val"))))))
|
||||
(is (do (nippy/extend-thaw 1 [s] (MyType. (.readUTF s)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue