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

On Fri, Aug 16, 2013 at 3:25 AM, Jonas Sicking <jonas@sicking.cc> wrote:

> On Thu, Aug 15, 2013 at 9:44 AM, Kinuko Yasuda <kinuko@chromium.org>
> wrote:
> >> requestQuota for temporary storage:
> >> I'd like to better understand the use case for requestQuota for
> temporary
> >> storage. Are implementations allowed to bring up a prompt when an
> increased
> >> temporary storage quota is requested? I thought one of the big use
> cases for
> >> temporary storage was that it would never trigger prompts, though
> obviously
> >> an exception could be made for the explicit requestQuota function.
> >>
> >> If the idea is for it not to bring up a prompt, why would we not simply
> >> always allocate the largest value that could be requested?
> >>
> >> Also, I think that we for temporary storage in Gecko would not want to
> >> guarantee that the allocated quota (as reported by queryQuota) for
> temporary
> >> storage will remain allocated for longer than the running page. I.e.
> once a
> >> page is closed, we might want to release the quota allocated and give
> it to
> >> another website.
> >
> > This is a very good feedback/question.  In Chrome we actually don't
> really
> > support requestQuota for temporary storage, we just silently ignore the
> > request but returns the current available quota to the requesting
> webapp.  I
> > also agree that it won't be desirable to preserve the quota allocated for
> > temporary storage.
> >
> > Seems like having this method take a storage type just confuses
> > readers/implementors, we should probably just drop the storage type
> > parameter and rename it to something like 'requestPersistentQuota', or
> only
> > add the method to 'navigator.persistentStorage' attribute?
>
> I think adding storageQuota.requestPersistentQuota would be a good
> solution. It seems cleaner than having a separate
> navigator.persistentStorage object.


Agreed, sounds good to me too.

Based on the feedbacks (thanks all) I've dropped {get,set}StorageType and
storageok and storagechange events from the draft.  (New events can be
added later whenever we find them useful with more concrete use cases)

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;
  };

  [NoInterfaceObject] interface StorageQuota {
    readonly attribute StorageType[] supportedTypes;

    // Queries the current storage info.
    Promise<StorageInfo> queryStorageInfo(StorageType type);

    // 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)
  };

  [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;
  };

More feedback on this rough draft is always welcome.  Also I'm going to
start updating the editor's draft based on this one and discussions we had
on this list.


> / Jonas
>

Received on Friday, 16 August 2013 13:57:27 UTC