[perf] remove unused schemas and properties

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-06-02 10:42:45 +02:00
parent 3826e3ecbd
commit 1cb7f3b83f
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
7 changed files with 31 additions and 57 deletions

View File

@ -10,7 +10,6 @@
status-im.data-store.transport status-im.data-store.transport
status-im.data-store.browser status-im.data-store.browser
status-im.data-store.accounts status-im.data-store.accounts
status-im.data-store.local-storage
status-im.data-store.mailservers)) status-im.data-store.mailservers))
(defn init [encryption-key] (defn init [encryption-key]

View File

@ -1,17 +0,0 @@
(ns status-im.data-store.local-storage
(:require [re-frame.core :as re-frame]
[status-im.data-store.realm.core :as core]))
(re-frame/reg-cofx
:data-store/get-local-storage-data
(fn [cofx _]
(assoc cofx :get-local-storage-data #(-> @core/account-realm
(core/get-by-field :local-storage :chat-id %)
(core/single-clj :local-storage)
:data))))
(defn set-local-storage-data-tx
"Returns tx function setting local storage data"
[data]
(fn [realm]
(core/create realm :local-storage data true)))

View File

@ -529,6 +529,22 @@
contact-recovery/v1 contact-recovery/v1
mailserver-requests-gap/v1]) mailserver-requests-gap/v1])
(def v45 [chat/v15
chat-requests-range/v1
transport/v9
contact/v8
message/v10
mailserver/v11
mailserver-topic/v2
user-status/v2
membership-update/v1
installation/v3
browser/v8
dapp-permissions/v9
contact-device-info/v1
contact-recovery/v1
mailserver-requests-gap/v1])
;; put schemas ordered by version ;; put schemas ordered by version
(def schemas [{:schema v1 (def schemas [{:schema v1
:schemaVersion 1 :schemaVersion 1
@ -661,4 +677,7 @@
:migration (constantly nil)} :migration (constantly nil)}
{:schema v44 {:schema v44
:schemaVersion 44 :schemaVersion 44
:migration (constantly nil)}
{:schema v45
:schemaVersion 45
:migration (constantly nil)}]) :migration (constantly nil)}])

View File

@ -68,3 +68,7 @@
(def v8 (assoc-in v7 [:properties :one-to-one] (def v8 (assoc-in v7 [:properties :one-to-one]
{:type :bool {:type :bool
:optional true})) :optional true}))
(def v9 (update v8 :properties
dissoc
:ack :seen :pending-ack :pending-send))

View File

@ -1,15 +1,9 @@
(ns status-im.data-store.transport (ns status-im.data-store.transport
(:require [cljs.tools.reader.edn :as edn] (:require [re-frame.core :as re-frame]
[re-frame.core :as re-frame]
[status-im.data-store.realm.core :as core])) [status-im.data-store.realm.core :as core]))
(defn deserialize-chat [serialized-chat] (defn deserialize-chat [serialized-chat]
(-> serialized-chat (dissoc serialized-chat :chat-id))
(dissoc :chat-id)
(update :ack edn/read-string)
(update :seen edn/read-string)
(update :pending-ack edn/read-string)
(update :pending-send edn/read-string)))
(re-frame/reg-cofx (re-frame/reg-cofx
:data-store/transport :data-store/transport
@ -29,12 +23,7 @@
(fn [realm] (fn [realm]
(core/create realm (core/create realm
:transport :transport
(-> chat (assoc chat :chat-id chat-id)
(assoc :chat-id chat-id)
(update :ack pr-str)
(update :seen pr-str)
(update :pending-ack pr-str)
(update :pending-send pr-str))
true))) true)))
(defn delete-transport-tx (defn delete-transport-tx

View File

@ -9,10 +9,6 @@
[status-im.constants :as constants])) [status-im.constants :as constants]))
;; required ;; required
(spec/def ::ack (spec/coll-of string? :kind vector?))
(spec/def ::seen (spec/coll-of string? :kind vector?))
(spec/def ::pending-ack (spec/coll-of string? :kind vector?))
(spec/def ::pending-send (spec/coll-of string? :kind vector?))
(spec/def ::resend? (spec/nilable #{"contact-request" "contact-request-confirmation" "contact-update"})) (spec/def ::resend? (spec/nilable #{"contact-request" "contact-request-confirmation" "contact-update"}))
;; optional ;; optional
@ -39,7 +35,7 @@
(spec/def :pairing/installation-id :global/not-empty-string) (spec/def :pairing/installation-id :global/not-empty-string)
(spec/def :pairing/device-type :global/not-empty-string) (spec/def :pairing/device-type :global/not-empty-string)
(spec/def :transport/chat (spec/keys :req-un [::ack ::seen ::pending-ack ::pending-send ::topic] (spec/def :transport/chat (spec/keys :req-un [::topic]
:opt-un [::sym-key-id ::sym-key ::resend?])) :opt-un [::sym-key-id ::sym-key ::resend?]))
(spec/def :transport/chats (spec/map-of :global/not-empty-string :transport/chat)) (spec/def :transport/chats (spec/map-of :global/not-empty-string :transport/chat))
(spec/def :transport/filters (spec/map-of :transport/filter-id (spec/coll-of :transport/filter))) (spec/def :transport/filters (spec/map-of :transport/filter-id (spec/coll-of :transport/filter)))
@ -48,11 +44,7 @@
"Initialize datastructure for chat representation at the transport level "Initialize datastructure for chat representation at the transport level
Currently only :topic is actually used" Currently only :topic is actually used"
[{:keys [topic resend? one-to-one now]}] [{:keys [topic resend? one-to-one now]}]
{:ack [] {:one-to-one (boolean one-to-one)
:seen []
:pending-ack []
:pending-send []
:one-to-one (boolean one-to-one)
:resend? resend? :resend? resend?
:topic topic}) :topic topic})

View File

@ -165,29 +165,17 @@
{:sym-key nil {:sym-key nil
:resend? nil :resend? nil
:topic nil :topic nil
:pending-ack [] :sym-key-id nil}
:seen []
:ack []
:sym-key-id nil
:pending-send []}
"0x043ae31038ff45a31b096a91d3f8290e079366fbbae76a00fbbd349cd0e5b8d7598965d206772ec4504f68908649a08383cdc51a52cdae5e9ccc744ace4d37020f" "0x043ae31038ff45a31b096a91d3f8290e079366fbbae76a00fbbd349cd0e5b8d7598965d206772ec4504f68908649a08383cdc51a52cdae5e9ccc744ace4d37020f"
{:sym-key nil {:sym-key nil
:resend? nil :resend? nil
:topic nil :topic nil
:pending-ack [] :sym-key-id nil}
:seen []
:ack []
:sym-key-id nil
:pending-send []}
"status" "status"
{:sym-key "0x36224048e42c49e5c59c57bba5024fbb8822d6b4ee6ac5fbefd8b77f5323ecc4" {:sym-key "0x36224048e42c49e5c59c57bba5024fbb8822d6b4ee6ac5fbefd8b77f5323ecc4"
:resend? nil :resend? nil
:topic "0xcd423760" :topic "0xcd423760"
:pending-ack [] :sym-key-id "2091c39cac37211987f63391b93d0bd021b9df247da50728bfd766946993849d"}})
:seen []
:ack []
:sym-key-id "2091c39cac37211987f63391b93d0bd021b9df247da50728bfd766946993849d"
:pending-send []}})
(def topics {"0xf8946aac" {:chat-ids #{:discovery-topic} (def topics {"0xf8946aac" {:chat-ids #{:discovery-topic}
:last-request 1547319670}}) :last-request 1547319670}})