DEV Community

Juan Pablo Ramirez
Juan Pablo Ramirez

Posted on

ULID in GO Lang

I have digging around for some time in audit-able ready log systems, as a core part of a decentralized environments and the core for trust between hosts. In epyphite (soon to be release) trust and transparency are important. For that reason we needed to come out with a way to generate a Unique Identifier that can be concurrent and millisecond friend. Specially when it comes to decentralized and high reliant systems.

Its very important to be able to have a unique identifier, timestamped and ordered that can point and trace fast to different events.

I came across with this github repo covering ULID that suited in that moment our needs.

But we had a problem...
In our environment millisecond are valuable, and by "secure by design" principle, we could not have events sharing the same timestamp ID. Every change is important, and the ability to search fast in between is at the most importance

Searching around I found this great article

So I decided to code those specs into an small library to share on Github.


Again.. all of this are WIP and they need to be expanded for use and documentation, but will get the idea.

The goal is to be able to generate sub buckets for a millisecond in a consistent, ordered , to have different sub id's that we can use. We do have limitations.. but for the specific use case that we were having this implementation was enough.


Any comments, feel free.
Happy Coding.

Discussion (0)