Merge branch 'dev'

This commit is contained in:
Peter Taoussanis 2015-02-18 17:37:32 +07:00
commit 79d261872f
5 changed files with 41 additions and 12 deletions

View file

@ -1,5 +1,13 @@
> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) as of **Aug 16, 2014**.
## v2.8.0 / 2015 Feb 18
> This is a **maintenance release** with some minor fixes and some dependency updates.
* **CHANGE**: Throw a clear error message on insufficient Encore dependency.
* **FIX** [#59]: `freezable?` should return true for clojure.lang.PersistentVector (@chairmanwow).
* **FIX** [#63]: Missing thaw exception cause (@cespare).
## v2.7.1 / 2014 Nov 27
> This is a **minor maintenance release** & should be a safe upgrade for users of v2.7.0/RC-1.

View file

@ -1,11 +1,9 @@
**[API docs][]** | **[CHANGELOG][]** | [other Clojure libs][] | [Twitter][] | [contact/contrib](#contact--contributing) | current [Break Version][]:
```clojure
[com.taoensso/nippy "2.7.1"] ; Please see CHANGELOG for details
[com.taoensso/nippy "2.8.0"] ; Please see CHANGELOG for details
```
v2.7 is a major, **mostly backwards-compatible** release focused on improved performance and a new default compression scheme (LZ4). See the [CHANGELOG][] for details. Thanks to [mpenet](https://github.com/mpenet) for his work on the LZ4 support!
# Nippy, a Clojure serialization library
Clojure's [rich data types](http://clojure.org/datatypes) are *awesome*. And its [reader](http://clojure.org/reader) allows you to take your data just about anywhere. But the reader can be painfully slow when you've got a lot of data to crunch (like when you're serializing to a database).
@ -34,7 +32,7 @@ Nippy is an attempt to provide a reliable, high-performance **drop-in alternativ
Add the necessary dependency to your [Leiningen][] `project.clj` and `require` the library in your ns:
```clojure
[com.taoensso/nippy "2.7.0"] ; project.clj
[com.taoensso/nippy "2.8.0"] ; project.clj
(ns my-app (:require [taoensso.nippy :as nippy])) ; ns
```

View file

@ -1,4 +1,4 @@
(defproject com.taoensso/nippy "2.7.1"
(defproject com.taoensso/nippy "2.8.0"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Clojure serialization library"
:url "https://github.com/ptaoussanis/nippy"
@ -12,8 +12,8 @@
:dependencies
[[org.clojure/clojure "1.4.0"]
[org.clojure/tools.reader "0.8.12"]
[com.taoensso/encore "1.16.2"]
[org.clojure/tools.reader "0.8.13"]
[com.taoensso/encore "1.21.0"]
[org.iq80.snappy/snappy "0.3"]
[org.tukaani/xz "1.5"]
[net.jpountz.lz4/lz4 "1.3"]]
@ -25,7 +25,7 @@
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:test {:jvm-opts ["-Xms1024m" "-Xmx2048m"]
:dependencies [[expectations "2.0.13"]
[org.clojure/test.check "0.6.1"]
[org.clojure/test.check "0.7.0"]
;; [com.cemerick/double-check "0.5.7"]
[org.clojure/data.fressian "0.2.0"]
[org.xerial.snappy/snappy-java "1.1.1.6"]]}

View file

@ -19,6 +19,18 @@
PersistentQueue PersistentTreeMap PersistentTreeSet PersistentList ; LazySeq
IRecord ISeq]))
;;;; Encore version check
(let [min-encore-version 1.21] ; Let's get folks on newer versions here
(if-let [assert! (ns-resolve 'taoensso.encore 'assert-min-encore-version)]
(assert! min-encore-version)
(throw
(ex-info
(format
"Insufficient com.taoensso/encore version (< %s). You may have a Leiningen dependency conflict (see http://goo.gl/qBbLvC for solution)."
min-encore-version)
{:min-version min-encore-version}))))
;;;; Nippy data format
;; * 4-byte header (Nippy v2.x+) (may be disabled but incl. by default) [1].
;; { * 1-byte type id.
@ -599,7 +611,8 @@
(thaw-from-in! dis))
(catch Exception e
(ex "Decryption/decompression failure, or data unfrozen/damaged.")))))
(ex "Decryption/decompression failure, or data unfrozen/damaged."
e)))))
;; This is hackish and can actually currently result in JVM core dumps
;; due to buggy Snappy behaviour, Ref. http://goo.gl/mh7Rpy.

View file

@ -50,7 +50,9 @@
;;;;
(defn- is-coll?
"Checks for _explicit_ IPersistentCollection types with Nippy support."
"Checks for _explicit_ IPersistentCollection types with Nippy support.
Checking for explicit concrete types is tedious but preferable since a
`freezable?` false positive would be much worse than a false negative."
[x]
(let [is? #(when (instance? % x) %)]
(or
@ -62,13 +64,21 @@
(is? clojure.lang.PersistentQueue)
(is? clojure.lang.PersistentTreeSet)
(is? clojure.lang.PersistentTreeMap)
(is? clojure.lang.IRecord)
(is? clojure.lang.PersistentVector$ChunkedSeq)
(is? clojure.lang.IRecord) ; TODO Possible to avoid the interface check?
(is? clojure.lang.LazySeq)
;; Too non-specific: could result in false positives (which would be a
;; serious problem here):
;; (is? clojure.lang.ISeq)
)))
(comment (is-coll? (clojure.lang.PersistentVector$ChunkedSeq. [1 2 3] 0 0)))
(defn freezable?
"Alpha - subject to change, may be buggy!
"Alpha - subject to change, MAY BE BUGGY!
Returns truthy value iff Nippy supports de/serialization of given argument.
Conservative with default options.