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
…1426)

This will make it easier to address #1405, but is beneficial in itself
because it indicates the scope of the uniqueness that was previously
implicit for strings.
  • Loading branch information
apasel422 authored Oct 11, 2024
1 parent dae2460 commit 98e9259
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 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 @@ -1125,9 +1125,9 @@ An <dfn>attribution rate-limit record</dfn> is a [=struct=] with the following i
: <dfn>expiry time</dfn>
:: Null or a [=moment=].
: <dfn>entity ID</dfn>
:: Null for [=obtain a fake report|fake reports=] or an [=event-level report=]'s [=event-level report/internal ID=] or an
[=aggregatable attribution report=]'s [=aggregatable attribution report/internal ID=] or an
[=attribution source=]'s [=attribution source/internal ID=].
:: Null for [=obtain a fake report|fake reports=] or an [=internal ID=] for an
[=event-level report=], [=aggregatable attribution report=], or
[=attribution source=].
: <dfn>deactivated for unexpired destination limit</dfn> (default false)
:: A [=boolean=].
: <dfn>destination limit priority</dfn> (default null)
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 @@ -2961,7 +2967,7 @@ A <dfn>destination limit record</dfn> is a [=struct=] with the following items:
: <dfn>time</dfn>
:: A [=moment=]
: <dfn>source ID</dfn>
:: A [=string=].
:: An [=internal ID=].

</dl>

Expand Down Expand Up @@ -4396,7 +4402,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 @@ -4426,7 +4432,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 @@ -4461,7 +4467,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 98e9259

Please sign in to comment.