W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: Quota API to query/request quota for offline storages (e.g. IndexedDB, FileSystem)

From: Eric Uhrhane <ericu@google.com>
Date: Thu, 3 Feb 2011 08:50:44 -0800
Message-ID: <AANLkTimVJoFgX-kzfMULuUB61eoMdu94siJY9cfu9ub+@mail.gmail.com>
To: Joćo Eiras <joao.eiras@gmail.com>
Cc: public-webapps@w3.org
On Thu, Feb 3, 2011 at 4:32 AM, Joćo Eiras <joao.eiras@gmail.com> wrote:
> Howdy.
>
>>   interface StorageInfo {
>
> Should probably be QuotaInfo or even QuotaManager ? Storage can and
> will be confused with Web Storage.
>
>>    // storage type
>>     const unsigned short TEMPORARY = 0;
>>     const unsigned short PERSISTENT = 1;
>>
>
> Only two values seem not enough for me and I disagre with the
> nomenclature. Would be betteer to have
> LOCAL_STORAGE, SESSION_STORAGE, WEB_SQL_DBS, INDEXED_DB and so on. But
> that would create artificial dependencies with the other specs, so it
> would be better if "type" passed to the query and request functions to
> just be an opaque string which would allow any offline storage spec to
> refer to this one instead and specify a type of their own like
> "localStorage", "sessionStorage", "indexedDb".

The point is that apps and users should be able to communicate about
how much disk space should be used.  Why would users care which API a
web app is using for its storage?  If google.com needs 10MB to store
my email, why should I care whether it's in indexedDB, localStorage,
or the FileSystem?

>>     // To query how much storage is available and currently in use.
>>     void queryUsage(unsigned short storageType,
>>                     UsageCallback usageCallback);
>>
>
> Given that quota values are usually just preferences, hence
> lightweight enough, this function should be sync for the sake of
> simplicity.

This doesn't request just the preference; it returns how much space is
actually used.  That might be an expensive operation, might require
disk IO to fetch a value from an internal database, etc.  By default,
we try to make all new APIs async so as not to constrain
implementation.

> General note: using bytes as measure is probably overkill. While I
> doubt localStorage would even exceed a couple megabytes, making an
> entire e-mail account available offline with indexedDb or web sql db
> could easily climb to a couple GBs. Perhaps kilobytes is better ?

Possibly, although there's no harm in allowing extra precision, and
nothing forcing UAs not to round values anyway.
Received on Thursday, 3 February 2011 16:51:32 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:43 GMT