Skip to main content

Module uuidv7

Module uuidv7 

Source
Expand description

Shared UUIDv7 identifier generation with strict 1ms spacing.

This generator is used by both the subtitle translation engine (for cue IDs) and the media discovery layer (for file IDs). Generating UUIDv7 IDs in batch order means the embedded unix_time_ts (the most-significant 48 bits) reflects request order and can be inspected from logs without consulting external state.

This module enforces an additional constraint on top of the UUIDv7 algorithm: adjacent ID generations are spaced by at least 1 millisecond, so each next ID’s unix_time_ts is strictly greater than the previous one. This avoids same-millisecond ambiguity that the standard UUIDv7 algorithm normally resolves through random or monotonic counter bits.

Structs§

Uuidv7Generator
Stateful UUIDv7 ID generator shared by media discovery and translation.

Functions§

generate_ids
Generate count UUIDv7 IDs in sequence with strict 1ms spacing.
unix_time_ms
Extract the 48-bit unix_time_ts field from a UUIDv7 value.