Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Data Persistence #181

Closed
seanwu1105 opened this issue Nov 11, 2020 · 3 comments
Closed

Refactor: Data Persistence #181

seanwu1105 opened this issue Nov 11, 2020 · 3 comments
Assignees
Labels
code Improvements to code quality or project architecture
Milestone

Comments

@seanwu1105
Copy link
Contributor

seanwu1105 commented Nov 11, 2020

We need levels of data persistence:

  • Low level
    • SQL or noSQL DB
    • To store on devices
    • Interface
      • Reactive could be better
        • Reactive should NOT fail outside ngZone
      • Easy to change DB
      • Use a global (singleton?) to register document or table name to check naming conflicts in runtime
  • Adapters
    • Converter between high and low levels
  • High level
    • Nested JavaScript object complying standard "Proof" API (protocol)
    • To display or data interchange
@seanwu1105 seanwu1105 added the code Improvements to code quality or project architecture label Nov 11, 2020
@seanwu1105 seanwu1105 added this to the backlog milestone Nov 11, 2020
@seanwu1105 seanwu1105 self-assigned this Nov 17, 2020
@seanwu1105
Copy link
Contributor Author

The low level for data persistence can be achieved with the Filesystem plugin from Capacitor. Each table is a big JSON file to store tuples. We also need a mutex lock to make sure each insertion or deletion on the same table is atomic. Furthermore, the codes for data persistence requires fully covered tests.

@seanwu1105
Copy link
Contributor Author

Quoted from Slack message:

找個穩定且有在積極維護的替代方案來儲存檔案,但是這件事情需要至少半個 sprint,而且需要多方嘗試與實做試試看來比較,上次有跟 @james 討論過 RxDB 等等替代方案。目前最快的 workaround 是直接 catch 掉所有 Capacitor.Filesystem.deleteFile() 產生的錯誤訊息。但是這個解決方法很爛,而且只會讓未來越來越難 debug。

@seanwu1105
Copy link
Contributor Author

seanwu1105 commented Nov 18, 2020

#227 has implemented a reliable solution to #181 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Improvements to code quality or project architecture
Projects
None yet
Development

No branches or pull requests

1 participant