Просмотр исходного кода

code cleanup suggested by gabriel

Tienson Qin 6 дней назад
Родитель
Сommit
64b218896a

+ 0 - 28
deps/db-sync/worker/scripts/dev_test.sh

@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-BASE_URL=${BASE_URL:-"http://127.0.0.1:8787"}
-GRAPH_ID=${GRAPH_ID:-"dev-graph"}
-
-SYNC_BASE="${BASE_URL}/sync/${GRAPH_ID}"
-
-curl -sS "${BASE_URL}/health"
-echo
-
-curl -sS "${SYNC_BASE}/health"
-echo
-
-curl -sS "${SYNC_BASE}/pull?since=0"
-echo
-
-curl -sS "${SYNC_BASE}/snapshot"
-echo
-
-curl -sS -X POST "${SYNC_BASE}/tx" \
-  -H "content-type: application/json" \
-  --data-binary '{"t-before":0,"tx":"[]"}'
-
-echo
-
-curl -sS "${SYNC_BASE}/pull?since=0"
-echo

+ 1 - 0
deps/db/src/logseq/db/common/initial_data.cljs

@@ -330,6 +330,7 @@
                         :logseq.kv/graph-uuid
                         :logseq.kv/local-graph-uuid
                         :logseq.kv/graph-rtc-e2ee?
+                        :logseq.kv/graph-remote?
                         :logseq.kv/latest-code-lang
                         :logseq.kv/graph-backup-folder
                         :logseq.kv/graph-text-embedding-model-name

+ 8 - 16
deps/db/src/logseq/db/frontend/kv_entity.cljs

@@ -8,37 +8,29 @@
    (defkeywords
      :logseq.kv/db-type                      {:doc "Set to \"db\" if it's a db-graph"}
      :logseq.kv/graph-uuid                   {:doc "Store graph-uuid if it's a rtc enabled graph"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/local-graph-uuid             {:doc "Store graph-uuid if it's a local graph"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/import-type                  {:doc "If graph is imported, identifies how a graph is imported including which UI or CLI import process. CLI scripts can set this to a custom value.
                                                  UI values include :file-graph and :sqlite-db and CLI values start with :cli e.g. :cli/default."}
      :logseq.kv/imported-at                  {:doc "Time if graph is imported"}
      :logseq.kv/graph-local-tx               {:doc "local rtc tx-id"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/schema-version               {:doc "Graph's current schema version"}
      :logseq.kv/remote-schema-version        {:doc "Graph's remote schema version.
 RTC won't start when major-schema-versions don't match"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/graph-created-at             {:doc "Graph's created at time"}
      :logseq.kv/latest-code-lang             {:doc "Latest lang used by a #Code-block"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/graph-backup-folder          {:doc "Backup folder for automated backup feature"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/graph-initial-schema-version {:doc "Graph's schema version when created"}
 
      :logseq.kv/graph-last-gc-at             {:doc "Last time graph gc at"
-                                              :rtc {:rtc/ignore-entity-when-init-upload true
-                                                    :rtc/ignore-entity-when-init-download true}}
+                                              :rtc {:rtc/ignore-entity-when-init-upload true}}
 
      :logseq.kv/graph-text-embedding-model-name   {:doc "Graph's text-embedding model name"
-                                                   :rtc {:rtc/ignore-entity-when-init-upload true
-                                                         :rtc/ignore-entity-when-init-download true}}
+                                                   :rtc {:rtc/ignore-entity-when-init-upload true}}
      :logseq.kv/graph-rtc-e2ee?              {:doc "true if it's a rtc graph with E2EE enabled"}
      :logseq.kv/graph-remote?                {:doc "true if it's a remote graph"})))

+ 1 - 3
deps/db/src/logseq/db/frontend/property.cljs

@@ -12,9 +12,7 @@
             [logseq.db.frontend.property.type :as db-property-type]))
 
 (def ^:private property-ignore-rtc
-  {:rtc/ignore-attr-when-init-upload true
-   :rtc/ignore-attr-when-init-download true
-   :rtc/ignore-attr-when-syncing true})
+  {:rtc/ignore-attr-when-syncing true})
 
 ;; Main property vars
 ;; ==================

+ 0 - 19
src/main/frontend/handler/db_based/rtc_background_tasks.cljs

@@ -31,25 +31,6 @@
         (log/info :trying-to-restart-rtc graph-uuid :t (t/now))
         (c.m/<? (rtc-handler/<rtc-start! (state/get-current-repo) :stop-before-start? false)))))))
 
-(comment
-  (run-background-task-when-not-publishing
-   ::notify-client-need-upgrade-when-larger-remote-schema-version-exists
-   (m/reduce
-    (constantly nil)
-    (m/ap
-      (let [{:keys [repo graph-uuid remote-schema-version sub-type]}
-            (m/?>
-             (m/eduction
-              (filter #(keyword-identical? :rtc.log/higher-remote-schema-version-exists (:type %)))
-              rtc-flows/rtc-log-flow))]
-        (case sub-type
-          :download
-          (rtc-handler/notification-download-higher-schema-graph! repo graph-uuid remote-schema-version)
-         ;; else
-          (notification/show!
-           "The server has a graph with a higher schema version, the client may need to upgrade."
-           :warning)))))))
-
 (run-background-task-when-not-publishing
  ;; stop rtc when [graph-switch user-logout]
  ::stop-rtc-if-needed

+ 1 - 12
src/main/frontend/worker/sync/const.cljs

@@ -5,21 +5,10 @@
             [logseq.db.frontend.property :as db-property]))
 
 (defkeywords
-  :rtc/ignore-attr-when-init-upload
-  {:doc "keyword option for RTC. ignore this *attr* when initial uploading graph. Default false"}
-  :rtc/ignore-attr-when-init-download
-  {:doc "keyword option for RTC. ignore this *attr* when initial downloading graph. Default false"}
   :rtc/ignore-attr-when-syncing
   {:doc "keyword option for RTC. ignore this *attr* when syncing graph. Default false"}
   :rtc/ignore-entity-when-init-upload
-  {:doc "keyword option for RTC. ignore this *entity* when initial uploading graph. Default false"}
-  :rtc/ignore-entity-when-init-download
-  {:doc "keyword option for RTC. ignore this *entity* when initial downloading graph. Default false"}
-
-  ;; only blocks(:block/uuid) will be synced, this option is meaningless for now
-  ;; :rtc/ignore-entity-when-syncing
-  ;; {:doc "keyword option for RTC. ignore this *entity* when syncing graph. Default false"}
-  )
+  {:doc "keyword option for RTC. ignore this *entity* when initial uploading graph. Default false"})
 
 (def ignore-attrs-when-syncing
   (into #{}