 (defn- join-generators
   [ks]
   (let [op-gens (keep {:basic basic-op-generators
-                       ;:batch batch-op-generators
                        :erase erasable-op-generators}
                       ks)]
     (fn [ctx]

    (dissoc model id)))


(defop GetBlockBatch
  [ids]

  (gen-args
    [blocks]
    [(gen/fmap (comp set keys) (gen-sub-map blocks))])

  (apply-op
    [this store]
    @(block/get-batch store ids))

  (check
    [this model result]
    (is (coll? result))
    (is (= (set (keep model ids))
           (set result)))))


(defop PutBlockBatch
  [blocks]

  (gen-args
    [blocks]
    [(gen/fmap (comp set vals) (gen-sub-map blocks))])

  (apply-op
    [this store]
    @(block/put-batch! store blocks))

  (check
    [this model result]
    (is (coll? result))
    (is (= (set blocks) (set result))))

  (update-model
    [this model]
    (into model (map (juxt :id identity) blocks))))


(defop DeleteBlockBatch
  [ids]

  (gen-args
    [blocks]
    [(gen/fmap (comp set keys) (gen-sub-map blocks))])

  (apply-op
    [this store]
    @(block/delete-batch! store ids))

  (check
    [this model result]
    (is (set? result))
    (is (= (set (filter (set ids) (keys model))) result)))

  (update-model
    [this model]
    (apply dissoc model ids)))


(defop EraseStore
  []



  (apply-op
    [this store]
    @(block/scan store :filter p))

  (check
    [this model result]
