     domains-info
     ))
 
-;; should delete any domains that don't exist in config as well
 ;; returns map of domain to domain info and launches futures that will fill in the domain info
 (defn- sync-data [global-config local-config token]
   (if (cache? global-config token)

      (try
        (delete-deleted-domains domains-info global-config local-config)
        (sync-data-updated domains-info global-config local-config)
        (log-message "Caching global config " cache-config)
        (cache-global-config! local-config cache-config)
        (log-message "Cached config " (read-cached-global-config local-config))

                        (fn [domain]
                          (use-cache-or-update domain domains-info global-config local-config))))

(defn cleanup-domains [fs domains-info global-config local-config]
  (let [lfs (local-filesystem)
        local-dir (:local-dir local-config)]
    (doseq [domain (keys domains-info)]
      (let [local-domain-root (str (path local-dir domain))
            remote-path (-> global-config :domains (get domain))
            remote-vs (DomainStore. fs remote-path)
            local-vs (DomainStore. lfs local-domain-root (.getSpec remote-vs))]
        (log-message "Cleaning up local domain versions (only keeping latest version) for domain: " domain)
        (.cleanup local-vs 1)))))

(defn sync-updated [global-config local-config token]
  "Only fetch domains from remote if a newer version is available.
