Skip to content

Commit

Permalink
Rename 'array key' to 'composite key'. For #360
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Apr 13, 2023
1 parent 7ff900f commit 324cd2c
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -595,14 +595,14 @@ A [=/key=] has an associated <dfn>type</dfn> which is one of:
*string*,
*binary*,
or
*array*.
*composite*.

A [=/key=] also has an associated <dfn>value</dfn>, which will
be either:
an {{unrestricted double}} if type is *number* or *date*,
a {{DOMString}} if type is *string*,
a [=byte sequence=] if type is *binary*,
or a [=/list=] of other [=/keys=] if type is *array*.
or a [=/list=] of other [=/keys=] if type is *composite*.

</div>

Expand All @@ -627,9 +627,9 @@ following the steps to [=convert a value to a key=].
will fail.
</aside>

An <dfn>array key</dfn> is a [=/key=] with [=key/type=] *array*.
The <dfn>subkeys</dfn> of an [=array key=] are the [=list/items=] of the
[=array key=]'s [=key/value=].
An <dfn>composite key</dfn> is a [=/key=] with [=key/type=] *composite*.
The <dfn>subkeys</dfn> of an [=composite key=] are the [=list/items=] of the
[=composite key=]'s [=key/value=].

<div algorithm>

Expand All @@ -641,8 +641,8 @@ To <dfn>compare two keys</dfn> |a| and |b|, run these steps:

1. If |ta| does not equal |tb|, then run these steps:

1. If |ta| is *array*, then return 1.
1. If |tb| is *array*, then return -1.
1. If |ta| is *composite*, then return 1.
1. If |tb| is *composite*, then return -1.
1. If |ta| is *binary*, then return 1.
1. If |tb| is *binary*, then return -1.
1. If |ta| is *string*, then return 1.
Expand Down Expand Up @@ -677,7 +677,7 @@ To <dfn>compare two keys</dfn> |a| and |b|, run these steps:
1. If |vb| is [=byte less than=] |va|, then return 1.
1. Return 0.

: *array*
: *composite*
::
1. Let |length| be the lesser of |va|'s [=list/size=] and |vb|'s [=list/size=].
1. Let |i| be 0.
Expand Down Expand Up @@ -712,9 +712,9 @@ of [=/comparing two keys=] with |a| and |b| is 0.
*Number* keys are less than *date* keys.
*Date* keys are less than *string* keys.
*String* keys are less than *binary* keys.
*Binary* keys are less than *array* keys.
*Binary* keys are less than *composite* keys.
There is no highest possible [=/key=] value.
This is because an array of any candidate highest [=/key=]
This is because a *composite* key of any candidate highest [=/key=]
followed by another [=/key=] is even higher.
</aside>

Expand Down Expand Up @@ -838,8 +838,8 @@ object store fails.

An [=/index=] has a <dfn>multiEntry flag</dfn>. This flag affects how
the index behaves when the result of evaluating the index's
[=index/key path=] yields an [=array key=]. If its [=index/multiEntry flag=]
is false, then a single [=object-store/record=] whose [=/key=] is an [=array key=]
[=index/key path=] yields an [=composite key=]. If its [=index/multiEntry flag=]
is false, then a single [=object-store/record=] whose [=/key=] is an [=composite key=]
is added to the index. If its [=index/multiEntry flag=] is true, then
one [=object-store/record=] is added to the index for each of the [=subkeys=].

Expand Down Expand Up @@ -1582,7 +1582,7 @@ be updated.

Only specified keys of [=key/type=] *number* can affect the
[=key generator/current number=] of the key generator. Keys of [=key/type=]
*date*, *array* (regardless of the other keys they
*date*, *composite* (regardless of the other keys they
contain), *binary*, or *string* (regardless of whether
they could be parsed as numbers) have no effect on the [=key generator/current
number=] of the key generator. Keys of [=key/type=]
Expand Down Expand Up @@ -5648,29 +5648,29 @@ To <dfn>store a record into an object store</dfn> with
</aside>

1. If |index|'s [=index/multiEntry flag=] is false, or if |index key|
is not an [=array key=], and if |index| already contains a
is not an [=composite key=], and if |index| already contains a
[=object-store/record=] with [=/key=] [=equal to=] |index
key|, and |index|'s [=index/unique flag=] is true, then this
operation failed with a "{{ConstraintError}}" {{DOMException}}. Abort this
algorithm without taking any further steps.

1. If |index|'s [=index/multiEntry flag=] is true and |index key| is
an [=array key=], and if |index| already contains a
an [=composite key=], and if |index| already contains a
[=object-store/record=] with [=/key=] [=equal to=] any of the
[=subkeys=] of |index key|, and |index|'s [=index/unique
flag=] is true, then this operation failed with a
"{{ConstraintError}}" {{DOMException}}. Abort this algorithm without taking any
further steps.

1. If |index|'s [=index/multiEntry flag=] is false, or if |index key|
is not an [=array key=] then store a record in |index|
is not an [=composite key=] then store a record in |index|
containing |index key| as its key and |key| as its value. The
record is stored in |index|'s [=index/list of records=]
such that the list is sorted primarily on the records keys,
and secondarily on the records values, in [=ascending=] order.

1. If |index|'s [=index/multiEntry flag=] is true and |index key| is
an [=array key=], then for each |subkey| of the
an [=composite key=], then for each |subkey| of the
[=subkeys=] of |index key| store a record in |index|
containing |subkey| as its key and |key| as its value. The
records are stored in |index|'s [=index/list of
Expand All @@ -5684,10 +5684,10 @@ To <dfn>store a record into an object store</dfn> with
</aside>

<aside class=note>
Even if any member of [=subkeys=] is itself an [=array key=],
Even if any member of [=subkeys=] is itself an [=composite key=],
the member is used directly as the key for the index record.
Nested [=array keys=] are not flattened or "unpacked" to
produce multiple rows; only the outer-most [=array key=] is.
Nested [=composite keys=] are not flattened or "unpacked" to
produce multiple rows; only the outer-most [=composite key=] is.
</aside>

1. Return |key|.
Expand Down Expand Up @@ -6360,7 +6360,7 @@ The steps return an ECMAScript value.
in |value|.
1. Return |buffer|.

: *array*
: *composite*
::
1. Let |array| be the result of executing the ECMAScript Array
constructor with no arguments.
Expand Down Expand Up @@ -6438,7 +6438,7 @@ steps may throw an exception.
1. Return a new [=/key=] with [=key/type=]
*binary* and [=key/value=] |bytes|.

<!-- Array -->
<!-- Composite (Array) -->
: If |input| is an [=ECMAScript/Array exotic object=]
::
1. Let |len| be [=ECMAScript/?=] [$ToLength$]( [=ECMAScript/?=] [$Get$](|input|,
Expand Down Expand Up @@ -6467,7 +6467,7 @@ steps may throw an exception.

1. Increase |index| by 1.

1. Return a new [=array key=] with [=key/value=]
1. Return a new [=composite key=] with [=key/value=]
|keys|.


Expand Down Expand Up @@ -6511,7 +6511,7 @@ steps may throw an exception.

1. Increase |index| by 1.

1. Return a new [=array key=] with [=key/value=] set to |keys|.
1. Return a new [=composite key=] with [=key/value=] set to |keys|.

1. Otherwise, return the result of [=/converting a
value to a key=] with argument |input|.
Expand All @@ -6525,7 +6525,7 @@ steps may throw an exception.
not be converted to keys are ignored, and duplicates are removed.

For example, the value `[10, 20, null, 30, 20]` is
converted to an [=array key=] with [=subkeys=] 10, 20, 30.
converted to an [=composite key=] with [=subkeys=] 10, 20, 30.
</aside>


Expand Down

0 comments on commit 324cd2c

Please sign in to comment.