 (defn merge-state [m k new-state]
   (update-in m [::todo k ::state] merge new-state))
 
+(def ^:private conj-set (fnil conj #{}))
+
+(declare get)
+(defn- update-indexes [m k]
+  (let [action (:action (get m k))]
+    (-> m
+        (update ::creatable (if (= :create action) conj-set disj) k)
+        (update ::deletable (if (= :delete action) conj-set disj) k))))
+
 (defn- assert-presence [presence]
   (assert (or (= :present presence)
               (= :absent presence))


(defn set-desired [m k presence]
  (assert-presence presence)
  (assoc-in m [::todo k ::desired] presence))

(defn set-actual [m k presence]
  (assert-presence presence)
  (assoc-in m [::todo k ::actual] presence))

(defn get [m k]
  (let [{::keys [state desired actual]

               :ignore)}))

(defn creatable [m]
  (->> (::creatable m)
       (map #(get-in m [::todo % ::state]))))

(defn deletable [m]
  (->> (::deletable m)
       (map #(get-in m [::todo % ::state]))))
