DEV Community

Juan Pablo Ramirez
Juan Pablo Ramirez

Posted on

1

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.

https://github.com/oklog/ulid

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

https://barkeywolf.consulting/posts/badger-event-store/

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

HERE

Again.. all of this are WIP and they need to be expanded for use and documentation, but ...you 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.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay