From bce0ea45a5c0c2ad8c9022fa1cdcc7e5555157ea Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Mon, 29 Jul 2013 15:59:24 +0700 Subject: [PATCH] v2.1.0 --- CHANGELOG.md | 11 +++++++++++ README.md | 25 +++++++++++++++++++++---- project.clj | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bcf319..4167ef8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## v2.0.0 → v2.1.0 + * Exposed low-level fns: `freeze-to-stream!`, `thaw-from-stream!`. + * Added `extend-freeze` and `extend-thaw` for extending to custom types: + * Added support for easily extending Nippy de/serialization to custom types: + ```clojure + (defrecord MyType [data]) + (nippy/extend-freeze MyType 1 [x steam] (.writeUTF stream (:data x))) + (nippy/extend-thaw 1 [stream] (->MyType (.readUTF stream))) + (nippy/thaw (nippy/freeze (->MyType "Joe"))) => #taoensso.nippy.MyType{:data "Joe"} + ``` + ## v1.2.1 → v2.0.0 * **MIGRATION NOTE**: Please be sure to use `lein clean` to clear old (v1) build artifacts! * Refactored for huge performance improvements (~40% roundtrip time). diff --git a/README.md b/README.md index 5994fdc..1b253c6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ **[API docs](http://ptaoussanis.github.io/nippy/)** | **[CHANGELOG](https://github.com/ptaoussanis/nippy/blob/master/CHANGELOG.md)** | [contact & contributing](#contact--contributing) | [other Clojure libs](https://www.taoensso.com/clojure-libraries) | [Twitter](https://twitter.com/#!/ptaoussanis) | current [semantic](http://semver.org/) version: ```clojure -[com.taoensso/nippy "2.0.0"] ; See CHANGELOG for changes since 1.x +[com.taoensso/nippy "2.1.0"] ; See CHANGELOG for changes since 1.x ``` v2 adds pluggable compression, crypto support (also pluggable), an improved API (including much better error messages), easier integration into other tools/libraries, and hugely improved performance. @@ -20,8 +20,9 @@ Nippy is an attempt to provide a reliable, high-performance **drop-in alternativ ## What's in the box™? * Small, uncomplicated **all-Clojure** library. * **Great performance**. - * Comprehesive, extensible **support for all major data types**. - * **Reader-fallback** for difficult/future types (including Clojure 1.4+ tagged literals). + * Comprehesive **support for all standard data types**. + * **Easily extendable to custom data types**. (v2.1+) + * **Reader-fallback** for all other types (including Clojure 1.4+ tagged literals). * **Full test coverage** for every supported type. * Fully pluggable **compression**, including built-in high-performance [Snappy](http://code.google.com/p/snappy/) compressor. * Fully pluggable **encryption**, including built-in high-strength AES128 enabled with a single `:password [:salted "my-password"]` option. (v2+) @@ -34,7 +35,7 @@ Nippy is an attempt to provide a reliable, high-performance **drop-in alternativ Add the necessary dependency to your [Leiningen](http://leiningen.org/) `project.clj` and `require` the library in your ns: ```clojure -[com.taoensso/nippy "2.0.0"] ; project.clj +[com.taoensso/nippy "2.1.0"] ; project.clj (ns my-app (:require [taoensso.nippy :as nippy])) ; ns ``` @@ -117,6 +118,22 @@ Nippy v2+ also gives you **dead simple data encryption**. Add a single option to There's two default forms of encryption on offer: `:salted` and `:cached`. Each of these makes carefully-chosen trade-offs and is suited to one of two common use cases. See the `aes128-encryptor` [docstring](http://ptaoussanis.github.io/nippy/taoensso.nippy.encryption.html) for a detailed explanation of why/when you'd want one or the other. +### Custom types (v2.1+, ALPHA - subject to change) + +```clojure +(defrecord MyType [data]) + +(nippy/extend-freeze MyType 1 ; A unique type id ∈[1, 128] + [x data-output-steam] + (.writeUTF data-output-stream (:data x))) + +(nippy/extend-thaw 1 ; Same type id + [data-input-stream] + (->MyType (.readUTF data-input-stream))) + +(nippy/thaw (nippy/freeze (->MyType "Joe"))) => #taoensso.nippy.MyType{:data "Joe"} +``` + ## Performance ![Comparison chart](https://github.com/ptaoussanis/nippy/raw/master/benchmarks.png) diff --git a/project.clj b/project.clj index 73f4592..7c22550 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.taoensso/nippy "2.0.0" +(defproject com.taoensso/nippy "2.1.0" :description "Clojure serialization library" :url "https://github.com/ptaoussanis/nippy" :license {:name "Eclipse Public License"