feat: export UUID and Int64 suffix length constants - #6
Merged
Conversation
Rename uuidSuffixLen/int64SuffixLen to UUIDSuffixLen/Int64SuffixLen so callers that length-classify a typeid string (e.g. peeling a fixed-width segment off a composite prefix) can reference the widths instead of hardcoding 26/13. The values are stable wire-format invariants; this is a pure API addition with no behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes the two id-encoding suffix widths as exported constants (
UUIDSuffixLen= 26,Int64SuffixLen= 13) so callers that length-classify a typeid string don't hardcode the numbers.The concrete motivation: a project-scoped API key encodes its project as a fixed-width segment inside a composite prefix (
pk_live_<project-13>_<key-26>), and the classifier peels it off by length. Today that means a localconst = 13mirroring typeid's internalint64SuffixLen. Referencingtypeid.Int64SuffixLenmakes the coupling explicit and removes the magic number.Pure rename of the existing unexported consts (
uuidSuffixLen/int64SuffixLen→UUIDSuffixLen/Int64SuffixLen) plus a doc comment. No behavior change; the values are stable wire-format invariants (a UUID is 128 bits, an Int64 is 63 bits).Test plan