 
 
 (deftype MeteredContentReader
-  [content record-io!]
+  [store metric-type block-id content]
 
   data/ContentReader
 
   (read-all
     [this]
-    (metering-input-stream (data/read-all content) record-io!))
+    (metering-input-stream
+      store metric-type block-id
+      (data/read-all content)))
 
 
   (read-range
     [this start end]
-    (metering-input-stream (data/read-range content start end) record-io!)))
+    (metering-input-stream
+      store metric-type block-id
+      (data/read-range content start end))))
 
 
 (alter-meta! #'->MeteredContentReader assoc :private true)

    (measure-method [:get-batch ids]
      (->> ids
           (block/get-batch store)
           (map (partial metered-block this ::read-bytes)))))


  (-put-batch!
    [this blocks]
    (measure-method [:put-batch! (mapv :id blocks)]
      (->> blocks
           (map (partial metered-block this ::write-bytes))
           (block/put-batch! store)
           (map (partial metered-block this ::read-bytes)))))


  (-delete-batch!


(defn- metered-block
  "Wrap the given block with a lazy constructor for a metered input stream
  which will report metrics."
  [store metric-type block]
  (when block
    (data/wrap-block
      block
      (partial ->MeteredContentReader
               store
               metric-type
               (:id block)))))



