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

Explore to change to a different storage service implementation #58957

Closed
1 of 5 tasks
bpasero opened this issue Sep 19, 2018 · 7 comments
Closed
1 of 5 tasks

Explore to change to a different storage service implementation #58957

bpasero opened this issue Sep 19, 2018 · 7 comments
Assignees
Labels
plan-item VS Code - planned item for upcoming workbench-state UI state across restarts

Comments

@bpasero
Copy link
Member

bpasero commented Sep 19, 2018

With Electron 3.0.x, the old SQLite based localStorage implementation will no longer be supported. We should think about coming up with our own storage solution for state. Related issues:

@bpasero
Copy link
Member Author

bpasero commented Oct 5, 2018

I am opening this issue for feedback from anyone interested in this matter (and ideally having experience with SQLite).

My current thinking is this:

  • use SQLite as new backend for anything that we store in window.localStorage today via the https://github.com/mapbox/node-sqlite3 node module
  • use 1 database for all global state (there can only be one, managed by the main process)
  • use 1 databases per workspace state (there will be many, managed by the renderer process)
  • have 1 table per database (CREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB)) - inspired by Chrome's own usage of SQLite for localStorage (before they moved to LevelDB)
  • leave the defaults of SQLite (do NOT set any PRAGMA)
  • never have more than 1 process connect to a database (at least not for writing, reading is fine)

Implementation (in storage.ts)

  • getItems(): SELECT * FROM ItemTable iterating over each result row
  • setItems(): INSERT INTO ItemTable VALUES (?,?) as a transaction to speed up bulk inserts
  • deleteItems(): DELETE FROM ItemTable WHERE key=? as a transaction to speed up bulk inserts

There will be a migration from the old localStorage DB to the new solution before any window opens.

@Astrantia
Copy link

@bpasero I'm not exactly sure if this is how the global state is supposed to work. Open up 2 insider editors, click ctrl+shift+x (to open extensions panel), resize it. Tab to the other vscode and notice that it hasn't been resized. Should it have been resized or not?
Another question, will update extensions without a reload feature land in this month's insiders? Thanks for all the work

@bpasero
Copy link
Member Author

bpasero commented Oct 18, 2018

@Astrantia we decided to not synchronise state such as the sidebar width across windows because it can well be that you are on a multi-monitor setup where you want to have individual sizes per window. It would be crazy if we would always put the same size on all windows, that would make multi-window work very hard imho.

will update extensions without a reload feature land in this month's insiders

No

@bpasero
Copy link
Member Author

bpasero commented Oct 22, 2018

The first part is merged to master, all workspace storage will be served from our own SQLite DB. Existing data is migrated out of window.localStorage.

@bpasero bpasero modified the milestones: October 2018, November 2018 Oct 24, 2018
@bpasero bpasero removed the help wanted Issues identified as good community contribution opportunities label Oct 27, 2018
@bpasero bpasero modified the milestones: November 2018, December 2018 Dec 1, 2018
@bpasero
Copy link
Member Author

bpasero commented Dec 10, 2018

Via #64719

@bpasero bpasero closed this as completed Dec 10, 2018
@Astrantia
Copy link

@bpasero I'm very curious about Updating extensions without a reload. Is vscode anywhere close to achieving it yet with having global storage implemented?

@bpasero
Copy link
Member Author

bpasero commented Dec 11, 2018

@Astrantia a bit closer but not there yet

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plan-item VS Code - planned item for upcoming workbench-state UI state across restarts
Projects
None yet
Development

No branches or pull requests

2 participants