Skip to content

Commit

Permalink
Use increasing integers instead of unique strings for internal IDs
Browse files Browse the repository at this point in the history
This will make it easier to address WICG#1405, but is beneficial in itself
because it indicates the scope of the uniqueness that was previously
implicit for strings.
  • Loading branch information
apasel422 committed Sep 11, 2024
1 parent 21d1eee commit 31e5c7e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ An attribution source is a [=struct=] with the following items:

<dl dfn-for="attribution source">
: <dfn>internal ID</dfn>
:: A [=string=].
:: An [=internal ID=].
: <dfn>source origin</dfn>
:: A [=suitable origin=].
: <dfn>event ID</dfn>
Expand Down Expand Up @@ -1011,7 +1011,7 @@ An attribution report is a [=struct=] with the following items:
: <dfn>external ID</dfn>
:: A UUID formatted as a [=string=].
: <dfn>internal ID</dfn>
:: A [=string=].
:: An [=internal ID=].

</dl>

Expand Down Expand Up @@ -1302,6 +1302,12 @@ shared among all [=environment settings objects=].
Note: This would ideally use <a spec=storage>storage bottles</a> to provide access to the attribution caches.
However attribution data is inherently cross-site, and operations on storage would need to span across all storage bottle maps.

An <dfn>internal ID</dfn> is an integer.

To <dfn>get the next internal ID</dfn>, return an [=internal ID=] strictly
greater than any previously returned by this algorithm. The user agent MAY reset
this sequence when no [=attribution cache=] entry contains an [=internal ID=].

# Constants # {#constants}

<dfn>Valid source expiry range</dfn> is a 2-tuple of positive [=durations=] that controls the
Expand Down Expand Up @@ -2273,7 +2279,7 @@ an [=aggregation coordinator=] |aggregationCoordinator|, and a [=moment=] |now|:
: [=aggregatable debug report/external ID=]
:: The result of [=generating a random UUID=]
: [=aggregatable debug report/internal ID=]
:: A new unique [=string=]
:: The result of [=getting the next internal ID=]
: [=aggregatable debug report/contributions=]
:: |contributions|
: [=aggregatable debug report/aggregation coordinator=]
Expand Down Expand Up @@ -2804,7 +2810,7 @@ To <dfn noexport>parse source-registration JSON</dfn> given a [=byte sequence=]
1. Let |source| be a new [=attribution source=] struct whose items are:

: [=attribution source/internal ID=]
:: A new unique [=string=]
:: The result of [=getting the next internal ID=]
: [=attribution source/source origin=]
:: |sourceOrigin|
: [=attribution source/event ID=]
Expand Down Expand Up @@ -4400,7 +4406,7 @@ a 64-bit integer priority |priority|, and a [=trigger spec map=] [=map/entry=]
: [=event-level report/external ID=]
:: The result of [=generating a random UUID=].
: [=event-level report/internal ID=]
:: A new unique [=string=]
:: The result of [=getting the next internal ID=]
: [=event-level report/attribution debug info=]
:: (|source|'s [=attribution source/debug key=], |triggerDebugKey|).
1. Return |report|.
Expand Down Expand Up @@ -4430,7 +4436,7 @@ an [=attribution trigger=] |trigger|:
: [=aggregatable attribution report/external ID=]
:: The result of [=generating a random UUID=].
: [=aggregatable attribution report/internal ID=]
: A new unique [=string=]
:: The result of [=getting the next internal ID=]
: [=aggregatable attribution report/attribution debug info=]
:: (|source|'s [=attribution source/debug key=], |trigger|'s [=attribution trigger/debug key=]).
: [=aggregatable attribution report/contributions=]
Expand Down Expand Up @@ -4465,7 +4471,7 @@ To <dfn>obtain a null attribution report</dfn> given an [=attribution trigger=]
: [=aggregatable attribution report/external ID=]
:: The result of [=generating a random UUID=]
: [=aggregatable attribution report/internal ID=]
: A new unique [=string=]
:: The result of [=getting the next internal ID=]
: [=aggregatable attribution report/attribution debug info=]
:: (null, |trigger|'s [=attribution trigger/debug key=])
: [=aggregatable attribution report/contributions=]
Expand Down

0 comments on commit 31e5c7e

Please sign in to comment.