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

use nanoids for entity id generation #100

Merged
merged 3 commits into from
Sep 1, 2023

Conversation

eth0net
Copy link
Contributor

@eth0net eth0net commented Sep 1, 2023

Description

This change switches the id generation to use nanoids instead of sequential numbers, allowing more flexibility without much concern for overlap.

The code is from release v0.2.0 of eth0net/nanoid-godot (MIT).

Currently it is configured to use 9 characters with a 64 character URL-safe alphabet, but this can be changed without an issue.

Tests have been updated to account for this change, including a hacky way of switching out the singleton Pandora backend for one of the tests due to restrictions around singletons.

There is no limitations placed on the contents of the ids in the code, only in the generator, meaning all the old sequential ids will continue to work. Perhaps some additional logic would be useful to migrate them though, as it would be safer going forward.

Any work done on the migration should take into account the possibility of being able to regenerate ids to change their length or alphabet, rather than just migrating from sequential to nanoid. This may be useful for forks of projects using Pandora or in other cases where people need to regenerate some or all of their ids.

Addressed issues

None

Screenshots

Screenshot 2023-09-01 at 18 18 05

@bitbrain
Copy link
Owner

bitbrain commented Sep 1, 2023

Thank you!

@bitbrain bitbrain merged commit 2cd9424 into bitbrain:godot-4.x Sep 1, 2023
3 checks passed
@eth0net eth0net deleted the switch-to-nanoid branch September 1, 2023 19:12
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.

2 participants