   (merge (block/meta-stats block)
          {:id (:id block)
           :size (:size block)}))
+
+
+(defn- prep-block
+  "Prepare a new block for storage."
+  [block]
+  (-> (block/load! block)
+      (data/clean-block)
+      (block/with-stats {:stored-at (Date.)})))
 
 
 ;; Block records in a memory store are held in a map in an atom.

  (-put!
    [this block]
    (when-let [id (:id block)]
      (if-let [extant (get @memory id)]
        extant
        (let [block' (-> (block/load! block)
                         (data/clean-block)
                         (block/with-stats {:stored-at (Date.)}))]
          (swap! memory assoc id block')
          block'))))


  (-delete!
    [this id]
    (let [existed? (contains? @memory id)]
      (swap! memory dissoc id)
      existed?)))




  "Creates a new in-memory block store."
  [& {:as opts}]
  (map->MemoryBlockStore
    (assoc opts :memory (ref (sorted-map) :validator map?))))


(defmethod store/initialize "mem"
