fix(native-fs): today journal not created automaticaly

Idb file handles should be cleared when unlinking a local directory.
This commit is contained in:
Tienson Qin
2020-12-11 01:59:30 +08:00
parent 914031649e
commit 690a090c87
12 changed files with 189 additions and 140 deletions

View File

@@ -5,6 +5,7 @@
[promesa.core :as p]
[clojure.string :as string]
[frontend.config :as config]
[frontend.util :as util]
[frontend.storage :as storage]))
;; offline db
@@ -53,3 +54,12 @@
(p/let [ks (get-keys)]
(->> (filter (fn [k] (string/starts-with? k (str config/idb-db-prefix config/local-db-prefix))) ks)
(map #(string/replace-first % config/idb-db-prefix "")))))
(defn clear-local-db!
[repo]
(when repo
(p/let [ks (get-keys)
ks (filter (fn [k] (string/starts-with? k (str config/local-handle "/" repo))) ks)]
(when (seq ks)
(p/all (map (fn [key]
(remove-item! key)) ks))))))