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

Bug 1679375 - Creates a Store interface and implements a WeakStore #6

Merged
merged 6 commits into from
Dec 3, 2020

Conversation

brizental
Copy link
Contributor

This creates a generic interface to be implemented by all our stores, which will be:

  • The different persistent stores that will need to be implemented per platform
  • A weak store that can be used by all platforms

The interface follows the store design described in Glean.js: Client-side storage for web extensions. Applying the suggestion of consolidating create/update into a single function and renaming read to get (just sounded nicer, IMO).

Although the functions and their proposed functionalities are basically the same as in the proposal, the function signatures deviate from it. That was necessary, because the signatures proposed did not take into account the fact that our stores may contain multi-level objects.

This PR contains only the WeakStore implementation, the store which will not persist data throughout application runs. This implementation could also be used in the future to serve as a mock implementation on the persistent store for tests as well.

Finally, it also contains a bit of housekeeping work, namely:

  • Added generated files to eslintignore;
  • Added some more properties to tsconfig;
  • Have CircleCI refrain from running the size check job on main (it fails on main and ultimately is unnecessary there).

@brizental
Copy link
Contributor Author

Build size report

Merging brizental#6 into main will:

  • Increase the size of the browser build (npm run build:browser) by 0%.
  • Increase the size of the Qt build (npm run build:qt) by 0%.

Build Current size New size Size increase
browser 4.44K 4.44K 📈 0%
qt 3.39K 3.39K 📈 0%

@brizental brizental changed the title Bug 1679375 - Create a Store interface and implements a WeakStore Bug 1679375 - Creates a Store interface and implements a WeakStore Dec 2, 2020
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/weak.ts Outdated Show resolved Hide resolved
src/storage/index.ts Outdated Show resolved Hide resolved
src/storage/index.ts Outdated Show resolved Hide resolved
src/storage/index.ts Outdated Show resolved Hide resolved
@brizental
Copy link
Contributor Author

Build size report

Merging brizental#6 into main will:

  • Increase the size of the browser build (npm run build:browser) by 0%.
  • Increase the size of the Qt build (npm run build:qt) by 0%.

Build Current size New size Size increase
browser 4.75K 4.75K 📈 0%
qt 3.69K 3.69K 📈 0%

src/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@Dexterp37 Dexterp37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+wc!

package.json Show resolved Hide resolved
src/storage/index.ts Show resolved Hide resolved
@brizental brizental merged commit 9120b10 into main Dec 3, 2020
@brizental brizental deleted the 1679375-storage branch December 3, 2020 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants