 (defn compact [dba]
   (assert (persistent? dba))
   (assert (not (compacting? dba)))
-  (exec/execute (:write-pipe ^dba)
+  (exec/execute (:write-pipe (meta dba))
     #(let [tmp-path      (io/tmp-path "/tmp" "compact")
            db-comp-start @dba]
        (alter-meta! dba assoc :write-buf (ArrayList.))
        (exec/spawn (fn []
          (write-to db-comp-start tmp-path)
-         (exec/execute (:write-pipe ^dba)
+         (exec/execute (:write-pipe (meta dba))
            (fn []
              (let [dos (io/dos-init tmp-path)]
-               (doseq [post-comp-command (:write-buf ^dba)]
+               (doseq [post-comp-command (:write-buf (meta dba))]
                  (io/dos-write dos post-comp-command))
-               (io/mv tmp-path (:write-path ^dba))
-               (io/dos-close (:write-dos ^dba))
+               (io/mv tmp-path (:write-path (meta dba)))
+               (io/dos-close (:write-dos (meta dba)))
                (alter-meta! dba dissoc :write-buf)
                (alter-meta! dba assoc  :write-dos dos))))))
        true)))

    :multi-write :checked-write})

(defn- dba? [dba]
  (? (:write-pipe ^dba)))

(defn- persistent? [dba]
  (? (:write-dos ^dba)))

(defn- ephemeral? [dba]
  (not (persistent? dba)))

(defn- compacting? [dba]
  (? (:write-buf ^dba)))

(defn- replay-command [db query]
  (first (core/query db query)))

    (init* db {:write-dos write-dos :write-path read-write-path})))

(defn close [dba]
  (exec/join-executor (:write-pipe (meta dba)) 60)
  (if-let [write-dos (:write-dos (meta dba))]
    (io/dos-close write-dos))
  (assert (compare-and-set! dba @dba nil))
  true)
