Permalink
Browse files

fix masai-layer update-fn to work with append-only option

  • Loading branch information...
1 parent b24d875 commit 10cdaeef6ea6aed92b54a871697b05ccea3c2963 @ninjudd ninjudd committed Sep 17, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/jiraph/masai_layer.clj
View
@@ -78,16 +78,17 @@
Optimized
(query-fn [this keyseq not-found f] nil)
(update-fn [this keyseq f]
- (when-let [[id & keys] (seq keyseq)]
- (let [{:keys [reduce-fn codec]} (format-for this id revision)]
- (when (= f reduce-fn)
- (fn [attrs]
- (->> (if keys
- (assoc-in {} keys attrs)
- attrs)
- (encode codec)
- (db/append! db (id->str id)))
- {:old nil :new attrs})))))
+ (when append-only?
+ (when-let [[id & keys] (seq keyseq)]
+ (let [{:keys [reduce-fn codec]} (format-for this id revision)]
+ (when (= f reduce-fn)
+ (fn [attrs]
+ (->> (if keys
+ (assoc-in {} keys attrs)
+ attrs)
+ (encode codec)
+ (db/append! db (id->str id)))
+ {:old nil :new attrs}))))))
Layer
(open [this]

0 comments on commit 10cdaee

Please sign in to comment.