Does IdGen work across cluster nodes with no collisions?
Closed this issue · 4 comments
Is IdGen works across cluster nodes with no collisions?
It should, yes, that's what it's designed for. As long as you assign unique generator ID's you should be fine.
Do you mean unique generator Id per node?
Do you have an example of how to convert the generated id to string like of YouTube Id?
Thanks
Do you mean unique generator Id per node?
Everything that generates ID's; be it a thread, a host, a cluster node, whatever. Have you read the how it works? In the default configuration you can have 1024 generators. But you can easily allow for more or less generators simply by adjusting the mask. NOTE that once you pick something and start using it you will be stuck with it! So allow for extra if you expect to need more in the future!
Do you have an example of how to convert the generated id to string like of YouTube Id?
That's not what this library is for, but you could simply base36 or base64 encode it for example.
You can also consider ULID's (or just plain old UUID's / GUID's). It just depends on your requirements.
I found answers to my questions the "how it works" section. Thanks