Re: Updating Quota API: Promise, Events and some more

On Fri, Aug 16, 2013 at 6:56 AM, Kinuko Yasuda <kinuko@chromium.org> wrote:

I had a few bike-sheddy comments as well.

> Now the new draft looks like:
>
>  enum StorageType { "temporary", "persistent" };
>
>   partial interface Navigator {
>     readonly attribute StorageQuota storageQuota;
>   };
>
>   [NoInterfaceObject] interface StorageInfo {
>     unsigned long long usageInBytes;
>     unsigned long long quotaInBytes;
>   };

I think these can be simplified to simply 'usage' and 'quota'. The
fact that it's in bytes doesn't really need to be spelled out in the
property name I think. Feedback that we've gotten from authors is that
they prefer short names.

>   [NoInterfaceObject] interface StorageQuota {
>     readonly attribute StorageType[] supportedTypes;
>
>     // Queries the current storage info.
>     Promise<StorageInfo> queryStorageInfo(StorageType type);

I think simply 'getInfo' might be enough here. It should already be
obvious that it's storage-quota related.

>     // Requests a new quota for persistent storage.
>     Promise<StorageInfo> requestPersistentQuota(unsigned long long
> newQuotaInBytes);
>
>     // Creates a new StorageWatcher object to watch the storage changes.
>     StorageWatcher createStorageWatcher(StorageType type)

This could probably simply be done using a constructor. I.e.

new StorageWatcher("persistent");

>   [NoInterfaceObject] interface createStorageWatcher {
>     // Fired when when the remaining storage space becomes lower
>     // than 10% of all available space for the type, or before the quota
> backend
>     // triggers eviction (for temporary case), whichever happens first.
>     attribute EventHandler onstoragelow;
>   };

Actually, the other two events made sense to me. Without onstorageok
the page has to poll queryStorageInfo to know when it's "out of the
woods".

Actually, *only* having onstoragechange would solve both the use case
of detecting when you are running low on storage, as well as when you
are "out of the woods". Especially if we provide both the quota and
the amount of used space in the event.

/ Jonas

Received on Friday, 16 August 2013 18:02:16 UTC