[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.browser
status-im.data-store.accounts
status-im.data-store.local-storage
status-im.data-store.mailservers))
(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
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
(def schemas [{:schema v1
:schemaVersion 1
@ -661,4 +677,7 @@
:migration (constantly nil)}
{:schema v44
:schemaVersion 44
:migration (constantly nil)}
{:schema v45
:schemaVersion 45
:migration (constantly nil)}])

View File

@ -68,3 +68,7 @@
(def v8 (assoc-in v7 [:properties :one-to-one]
{:type :bool
: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
(:require [cljs.tools.reader.edn :as edn]
[re-frame.core :as re-frame]
(:require [re-frame.core :as re-frame]
[status-im.data-store.realm.core :as core]))
(defn deserialize-chat [serialized-chat]
(-> serialized-chat
(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)))
(dissoc serialized-chat :chat-id))
(re-frame/reg-cofx
:data-store/transport
@ -29,12 +23,7 @@
(fn [realm]
(core/create realm
:transport
(-> chat
(assoc :chat-id chat-id)
(update :ack pr-str)
(update :seen pr-str)
(update :pending-ack pr-str)
(update :pending-send pr-str))
(assoc chat :chat-id chat-id)
true)))
(defn delete-transport-tx

View File

@ -9,10 +9,6 @@
[status-im.constants :as constants]))
;; 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"}))
;; optional
@ -39,7 +35,7 @@
(spec/def :pairing/installation-id :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?]))
(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)))
@ -48,11 +44,7 @@
"Initialize datastructure for chat representation at the transport level
Currently only :topic is actually used"
[{:keys [topic resend? one-to-one now]}]
{:ack []
:seen []
:pending-ack []
:pending-send []
:one-to-one (boolean one-to-one)
{:one-to-one (boolean one-to-one)
:resend? resend?
:topic topic})

View File

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