-
Notifications
You must be signed in to change notification settings - Fork 23
Add Type Registry for IDs #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
santanusinha
merged 8 commits into
appform-io:main
from
CyberDrudge:weighted-ig-generation-formatter
Jun 9, 2025
Merged
Add Type Registry for IDs #58
santanusinha
merged 8 commits into
appform-io:main
from
CyberDrudge:weighted-ig-generation-formatter
Jun 9, 2025
Conversation
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
r0goyal
reviewed
Feb 19, 2025
...-bundle/src/main/java/io/appform/ranger/discovery/bundle/id/formatter/Base36IdFormatter.java
Outdated
Show resolved
Hide resolved
r0goyal
reviewed
Feb 19, 2025
...iscovery-bundle/src/main/java/io/appform/ranger/discovery/bundle/id/formatter/IdParsers.java
Show resolved
Hide resolved
r0goyal
reviewed
Feb 25, 2025
...iscovery-bundle/src/main/java/io/appform/ranger/discovery/bundle/id/formatter/IdParsers.java
Show resolved
Hide resolved
r0goyal
reviewed
Feb 25, 2025
...er-discovery-bundle/src/test/java/io/appform/ranger/discovery/bundle/id/IdGeneratorTest.java
Show resolved
Hide resolved
Please explain the changes @CyberDrudge .. I have zero context |
santanusinha
approved these changes
Jun 9, 2025
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.
Currently ID string generated by IDGenerator has a specific format (with date time, nodeId and nonce encoded in ID).
These generated IDs can be parsed back to the exact DateTime (including millisecond precision) and nonce. In future, we aim to support more formats of IDs (specifically placement of date time (granularity of timestamp), nodeId and nonce components).
This PR aims at adding a type to the generated ID (additional two characters will be used as suffix for this) in order to allow flexibility in future for multiple formats.
Why suffix and not prefix ?
Currently ID Generator allows calling client to provide a
prefix
of arbitrary length. This prefix is attached to the base format. There is no restriction on length of this prefix and hence addingtype
as a prefix would be ambiguous during parsing.Will suffix work in all scenarios ?
A fundamental assumption is taken that any ID generated by ID Generator today is using the Default Formatter (This should always be the case). This formatter uses exactly 22 characters (and starts with a numeric value). Prefix is expected to be alphabetical. Under these assumptions, adding a two-char suffix would work deterministically. If the prefix contains numeric characters as suffix, this implementation would break the parsing logic.
One such use case is to reduce granularity of time to second (in order to pre-generate IDs in a pool and cache them in memory). Sample PR for this -#61.