So with the chrome extension API for storing data, you can either store it in the "chrome.storage.local" storage (on the device) or "chrome.storage.sync" storage, which saves the data on Google servers so you can sync your settings across computers. But these are pretty different in their constraints: "local" has a lot more space available to it, and it doesn't stop you from writing a lot of stuff really fast. But "sync" has more limitations: it limits how much you can store there, and limits how fast you can write there. And it's pretty logical: Chrome doesn't want some evil extension to just start writing tons and tons of bad data and take down Chrome Sync or break other extensions (or Chrome itself?)
This turns out to be a big problem in the extension, because the full set of user-agents that others have amassed online are larger than what sync will store. Also, importing all of them at once hits its max writes-per-hour limit, so the user cannot edit any settings for an hour(!!!) Couple this with the fact that a lot of users don't want to have Sync on at all, so it's logical to have the sync functionality to be opt-in.
But I still need to solve the space problem when a user has lots of "local" data and suddenly wants to turn on sync. I have to warn the user that not all of that data is going to get sync'ed -- or that they cannot import the mega-list of user-agents, which is a common use case.
So what I hacked on yesterday was the ability to move data to and from chrome.storage.local and chrome.storage.sync, but it does it "unintelligently", so if chrome.storage.sync runs out of space, it just dies. The next step is to alert the user that there is not enough space to import or turn on Sync (and what they can do about it).
No comments:
Post a Comment