Skip to content
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

Add construct() methods to specify the milliseconds being used for time-based UUID generation #84

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

BranchPredictor
Copy link
Contributor

@BranchPredictor BranchPredictor commented Sep 7, 2023

This is useful for migrating existing sets of data which include a timestamp, but don't use ordered UUID values.

…ed UUID generation.

This is useful for migrating existing sets of data which include a timestamp, but don't use ordered UUID values.
Copy link
Owner

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Will check again later on and merge unless I find concerns (unlikely but just in case).

@cowtowncoder cowtowncoder changed the title Add methods to specify the epoch milliseconds being used for time bas… Add methods to specify the epoch milliseconds being used for time-based UUID generation Sep 8, 2023
return generate(_clock.currentTimeMillis());
}

public UUID generate(long rawTimestamp)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this as construct(), since it's not fully generating any more.

Also add Javadoc with @since 4.3 to indicate addition.

return generate(rawTimestamp);
}

public UUID generate(long rawTimestamp)
Copy link
Owner

@cowtowncoder cowtowncoder Sep 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as above.

Plus can avoid assignment and just call construct(_timer.getTimestamp());

@cowtowncoder
Copy link
Owner

Ok, aside from 2 comments one missing thing: TimeBasedReorderedGenerator should get the new method as well.

With those I'm happy to merge this!

- add @SInCE in javadoc
- rename generate to construct
- include new api in TimeBasedReorderedGenerator
@BranchPredictor
Copy link
Contributor Author

Have made updates based on PR review.

@cowtowncoder cowtowncoder changed the title Add methods to specify the epoch milliseconds being used for time-based UUID generation Add construct() methods to specify the milliseconds being used for time-based UUID generation Sep 12, 2023
@cowtowncoder cowtowncoder merged commit 7ddb95a into cowtowncoder:master Sep 12, 2023
2 checks passed
cowtowncoder added a commit that referenced this pull request Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants