Skip to content

Commit

Permalink
Use parallel queue for StorageBucketManager (#110)
Browse files Browse the repository at this point in the history
* Create parallel queue

* Update bucket manager to use parallel queue

* Address comments

* Fix english
  • Loading branch information
ayuishii authored Oct 9, 2023
1 parent 2260720 commit 21a6caf
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Each [=environment settings object=] has an associated {{StorageBucketManager}}
The <dfn attribute for=NavigatorStorageBuckets><code>storageBuckets</code></dfn>
getter steps are to return [=this=]'s [=/relevant settings object=]'s {{StorageBucketManager}} object.

A user agent has an associated <dfn for=StorageBucketManager><code>storage bucket manager</code></dfn> which is the result of [=starting a new parallel queue=].

<xmp class="idl">
[Exposed=(Window,Worker),
SecureContext]
Expand Down Expand Up @@ -82,11 +84,17 @@ The <dfn method for="StorageBucketManager">open(|name|, |options|)</dfn> method

1. If the result of [=validate a bucket name=] with |name| is failure, then return [=a promise rejected with=] a {{TypeError}}.

1. Let |r| be the result of running [=open a bucket=] with |shelf|, |name|, and |options|.
1. Let |p| be [=a new promise=].

1. [=Enqueue the following steps=] to [=StorageBucketManager/storage bucket manager=]:

1. If |r| is failure, then return [=a promise rejected with=] a {{TypeError}}.
1. Let |r| be the result of running [=open a bucket=] with |shelf|, |name|, and |options|.

1. Return [=a promise resolved with=] with |r|.
1. If |r| is failure, then [=queue a storage task=] to [=/reject=] |p| with a {{TypeError}}.

1. Otherwise, [=queue a storage task=] to [=/resolve=] |p| with |r|.

1. Return |p|.

</div>

Expand Down Expand Up @@ -182,15 +190,13 @@ The <dfn method for="StorageBucketManager">delete(|name|)</dfn> method steps are

1. Let |p| be [=a new promise=].

1. Run the following steps [=in parallel=]:
1. If the result of [=validate a bucket name=] with |name| is failure, then [=/reject=] |p| with an {{InvalidCharacterError}}.

1. If the result of [=validate a bucket name=] with |name| is failure, then [=/reject=] |p| with an {{InvalidCharacterError}} and abort these steps.
1. Otherwise, [=enqueue the following steps=] to [=StorageBucketManager/storage bucket manager=]:

1. Let |r| be the result of running [=remove a bucket=] with |shelf| and |name|.
1. Run [=remove a bucket=] with |shelf| and |name|.

1. If |r| is failure, then [=/reject=] |p| with {{TypeError}}.

1. Otherwise, [=/resolve=] |p|.
1. [=Queue a storage task=] to [=/resolve=] |p|.

1. Return |p|.

Expand Down Expand Up @@ -236,13 +242,15 @@ The <dfn method for="StorageBucketManager">keys()</dfn> method steps are:

1. Let |keys| be a new [=/list=].

1. For each |key| in |shelf|'s [=bucket map=], run the following steps:
1. [=Enqueue the following steps=] to [=StorageBucketManager/storage bucket manager=]:

1. For each |key| in |shelf|'s [=bucket map=], run the following steps:

1. Let |bucket| be the result of running [=get or expire a bucket=] with |shelf| and |key|.
1. Let |bucket| be the result of running [=get or expire a bucket=] with |shelf| and |key|.

1. If |bucket| is non-null, [=list/append=] |key| to |keys|.
1. If |bucket| is non-null, [=list/append=] |key| to |keys|.

1. [=Queue a storage task=] to [=/resolve=] |p| with |keys|.
1. [=Queue a storage task=] to [=/resolve=] |p| with |keys|.

1. Return |p|.

Expand Down

0 comments on commit 21a6caf

Please sign in to comment.