jetify-com / typeid

Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs
Apache License 2.0
2.92k stars 38 forks source link

new Rust implementation #35

Closed rrrodzilla closed 1 week ago

rrrodzilla commented 2 months ago

Hey everyone,

I've got a new Rust implementation of the TypeId spec that I'd love to share. It's called mti and it offers a different approach by adding extensions to strings, allowing them to behave and parse like TypeIds while maintaining type safety.

What's cool about this implementation:

  1. It's split into three crates:

  2. The TypeIdSuffix and TypeIdPrefix crates are designed for independent use. They've been thoroughly fuzz tested, prop tested, and formally verified.

  3. Both the mti and TypeIdPrefix crates include an optional prefix sanitization feature, which guarantees a valid prefix is created even from bad data.

  4. This split design allows for some neat tricks in high-volume data pipeline processing. For example, you can generate prefixes and suffixes separately and combine them later to maintain high throughput.

I've been using this in a distributed actor framework I'm working on, and it's been pretty slick so far.

Future plans:

Thanks for all your hard work on the spec! Let me know if you need any more info or if you'd like to include this implementation.

loreto commented 2 months ago

@rrrodzilla Thanks for putting together this crate. It looks great.

Two quick thoughts:

  1. In the crate's README (https://crates.io/crates/mti) the link to Jetify is jetify.io but that's a dead page, it should actually be jetify.com – if you don't mind updating it :)

  2. Let's go ahead and advertise your implementation in our typeid README. Do you want to go ahead and send me a PR modifying this table: https://github.com/jetify-com/opensource/blob/main/typeid/typeid/README.md#community-provided-implementations – we'd be happy to approve it and merge it in.