status-im / pluto

https://status-im.github.io/pluto/
12 stars 3 forks source link

Implement extension data storage #29

Closed jeluard closed 5 years ago

jeluard commented 6 years ago

Each extension can easily store and retrieve isolated data. Datomic pull API will be considered. https://anmonteiro.com/2016/01/om-next-query-syntax/

flexsurfer commented 6 years ago

https://github.com/district0x/d0x-INFRA/blob/master/re-mount.md

jeluard commented 6 years ago

Tentative syntax:

Given an event that generates a response through another event:

[ethereum/send-transaction {:from ...
                                               :to ...
                                                :on-result [store/put {:key :some-key}]}]

This response is stored in an isolated location of the app-db specific to this extension (based on the unique extension id -per host-).

This data can then be accessed via a matching query:

views/some-view
(let [{content :content} [store/get {:key :some-key}]]
  [text {}
    content])
bhauman commented 6 years ago

Are you thinking that store/put syntax will work for key paths? [store/put {:key [:some-key :other-key] }]

No necessarily suggesting this syntax just wondering about common cases.

jeluard commented 6 years ago

As a first step I was considering using dumb key/value. Probably is sufficient for most of use cases and for more advanced scenarios we could investigate something like datomic pull API.

If we introduce seq keys then the get becomes trickier: how do we handle partial seq of keys? e.g. [store/get {:key [:some-key :other-key]}]