Merge branch 'dev': v0.10.1

This commit is contained in:
Peter Taoussanis 2012-08-15 23:25:47 +07:00
commit 5a893b29c9
3 changed files with 8 additions and 27 deletions

View file

@ -1,12 +1,12 @@
Current [semantic](http://semver.org/) version: Current [semantic](http://semver.org/) version:
```clojure ```clojure
[com.taoensso/nippy "0.10.0"] [com.taoensso/nippy "0.10.1"]
``` ```
**Breaking changes** (minor) since _0.9.x_: **Breaking changes** since _0.9.x_:
* Affecting **users that were manually disabling compression**: * Affecting **users that were manually disabling compression**:
* API has changed for `freeze-to-bytes` and `thaw-from-bytes` _when not using default options_. * API has changed for `freeze-to-bytes` and `thaw-from-bytes` when not using default options.
# Nippy, a serialization library for Clojure # Nippy, a serialization library for Clojure
@ -40,7 +40,7 @@ Nippy uses [Snappy](http://code.google.com/p/snappy-java/) which currently has a
Depend on Nippy in your `project.clj`: Depend on Nippy in your `project.clj`:
```clojure ```clojure
[com.taoensso/nippy "0.10.0"] [com.taoensso/nippy "0.10.1"]
``` ```
and `require` the library: and `require` the library:

View file

@ -1,4 +1,4 @@
(defproject com.taoensso/nippy "0.10.0" (defproject com.taoensso/nippy "0.10.1"
:description "Simple, high-performance Clojure serialization library." :description "Simple, high-performance Clojure serialization library."
:url "https://github.com/ptaoussanis/nippy" :url "https://github.com/ptaoussanis/nippy"
:license {:name "Eclipse Public License"} :license {:name "Eclipse Public License"}
@ -6,15 +6,9 @@
[org.xerial.snappy/snappy-java "1.0.4.1"]] [org.xerial.snappy/snappy-java "1.0.4.1"]]
:profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]} :profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]} :1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]} :1.5 {:dependencies [[org.clojure/clojure "1.5.0-alpha3"]]}
:dev {:dependencies []} :dev {:dependencies []}
:test {:dependencies []}} :test {:dependencies []}}
:repositories {"sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"
:snapshots false
:releases {:checksum :fail :update :always}}
"sonatype-snapshots" {:url "http://oss.sonatype.org/content/repositories/snapshots"
:snapshots true
:releases {:checksum :fail :update :always}}}
:aliases {"test-all" ["with-profile" "test,1.3:test,1.4:test,1.5" "test"]} :aliases {"test-all" ["with-profile" "test,1.3:test,1.4:test,1.5" "test"]}
:min-lein-version "2.0.0" :min-lein-version "2.0.0"
:warn-on-reflection true) :warn-on-reflection true)

View file

@ -12,8 +12,6 @@
;;;; Define type IDs ;;;; Define type IDs
(def ^:const schema-header "\u0000~0.9.0")
;; 1 ;; 1
(def ^:const id-bytes (int 2)) (def ^:const id-bytes (int 2))
(def ^:const id-nil (int 3)) (def ^:const id-nil (int 3))
@ -156,7 +154,6 @@
"Serializes x to given output stream." "Serializes x to given output stream."
[data-output-stream x] [data-output-stream x]
(binding [*print-dup* true] ; For `pr-str` (binding [*print-dup* true] ; For `pr-str`
(freeze-to-stream!* data-output-stream schema-header)
(freeze-to-stream!* data-output-stream x))) (freeze-to-stream!* data-output-stream x)))
(defn freeze-to-bytes (defn freeze-to-bytes
@ -223,22 +220,12 @@
(throw (Exception. (str "Failed to thaw unknown type ID: " type-id)))))) (throw (Exception. (str "Failed to thaw unknown type ID: " type-id))))))
;; TODO Scheduled for Carmine version 1.0.0
;; (defn thaw-from-stream!
;; "Deserializes an object from given input stream."
;; [data-input-stream read-eval?]
;; (binding [*read-eval* read-eval?]
;; (let [schema-header (thaw-from-stream!* data-input-stream)]
;; (thaw-from-stream!* data-input-stream))))
;; DEPRECATED: Includes temporary support for older versions of serialization
;; schema that didn't include a version header. This is for people that used
;; Carmine < 0.8.3 and haven't yet migrated their databases.
(defn thaw-from-stream! (defn thaw-from-stream!
"Deserializes an object from given input stream." "Deserializes an object from given input stream."
[data-input-stream read-eval?] [data-input-stream read-eval?]
(binding [*read-eval* read-eval?] (binding [*read-eval* read-eval?]
(let [maybe-schema-header (thaw-from-stream!* data-input-stream)] (let [;; Support older versions of Nippy that wrote a version header
maybe-schema-header (thaw-from-stream!* data-input-stream)]
(if (and (string? maybe-schema-header) (if (and (string? maybe-schema-header)
(.startsWith ^String maybe-schema-header "\u0000~")) (.startsWith ^String maybe-schema-header "\u0000~"))
(thaw-from-stream!* data-input-stream) (thaw-from-stream!* data-input-stream)