Skip to main content

Module identity

Module identity 

Source
Expand description

Logical identities, shared cache keys and rollout cohorts.

Key construction follows the portable protocol (W01–W03): URI component escaping, tracked entity hash tags, ordered argument pairs, the frame key suffix, and FNV-1a cohorts over UTF-16 code units.

Structs§

Identity
A normalized logical identity. Ordered arguments retain caller order; use normalize_args to build them from a host-language record.
Keys
Derived key strings of one identity.

Enums§

ArgValue
A host scalar accepted as a key argument.
IdentityError
Why an identity cannot form a key.

Traits§

IntoKeyId
Converts an entity identifier to the text used in a cache key.

Functions§

cohort
Deterministic rollout sample in [0, 100) for a logical key and layer or shadow discriminator: FNV-1a over the UTF-16 units of key:discriminator.
cohort_hash
FNV-1a 32-bit hash over the UTF-16 code units of logical_key:discriminator; the integer numerator behind cohort.
compare_utf16
Compare two strings by UTF-16 code units, as JavaScript’s < does.
escape_component
encodeURIComponent escaping of one component.
js_number_to_string
Spell a number the way JavaScript’s String(number) does.
keys
Build every key of an identity.
normalize_args
Normalize a record of key arguments: omit absent values, spell scalars the JavaScript way, and sort names by UTF-16 code units.