From f38e8536ded017a630ffdefbc2b57ce178258e13 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sun, 30 Jul 2023 10:42:31 -0700 Subject: [PATCH] more tweaks --- content/sundries/presenting-julids/index.md | 28 +++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/content/sundries/presenting-julids/index.md b/content/sundries/presenting-julids/index.md index 105aa00..715b84b 100644 --- a/content/sundries/presenting-julids/index.md +++ b/content/sundries/presenting-julids/index.md @@ -1,7 +1,7 @@ +++ -title = "Presenting Julids: another fine sundry, by Nebcorp Heavy Industries and Sundries" +title = "Presenting Julids, another fine sundry by Nebcorp Heavy Industries and Sundries" slug = "presenting-julids" -date = "2023-07-29" +date = "2023-07-31" [taxonomies] tags = ["software", "sundry", "proclamation", "sqlite", "rust", "ulid", "julid"] +++ @@ -10,9 +10,9 @@ tags = ["software", "sundry", "proclamation", "sqlite", "rust", "ulid", "julid"] Nebcorp Heavy Industries and Sundries, long the world leader in sundries, is proud to announce the public launch of the official identifier type for all Nebcorp companies' assets and database entries, [Julids](https://gitlab.com/nebkor/julid). Julids are globally unique sortable identifiers, -backwards-compatible with [ULIDs](https://github.com/ulid/spec), but better. +backwards-compatible with [ULIDs](https://github.com/ulid/spec), *but better*. -Inside your Rust program, simply add `julid-rs` to your project's `Cargo.toml` file, and use it +Inside your Rust program, simply add `julid-rs`[^julid-package] to your project's `Cargo.toml` file, and use it like: ``` rust @@ -206,7 +206,7 @@ $ cargo run --example=benchmark --release -- -n 30000 2> /dev/null That's about 24,000 IDs/millisecond; 24 *MILLION* per second! The default optional Cargo features include implementations of traits for getting Julids into and -out of SQLite via [SQLx](https://github.com/launchbadge/sqlx), and for generally +out of SQLite with [SQLx](https://github.com/launchbadge/sqlx), and for generally serializing/deserializing with [Serde](https://serde.rs/), via the `sqlx` and `serde` features, respectively. One final default optional feature, `chrono`, uses the Chrono crate to return the timestamp as a [`DateTime`](https://docs.rs/chrono/latest/chrono/struct.DateTime.html) by adding a @@ -226,12 +226,12 @@ here](/rnd/one-part-serialized-mystery-part-2)). What's, uh... what's up with th ![marge just thinks they're neat][marge ids]
we both just think they're neat
-Like Marge says, I just think they're neat! I'm not the only one; here are just some alternatives: +Like Marge, I just think they're neat! We're not the only ones; here are just some related projects: * Segment's [KSUID](https://segment.com/blog/a-brief-history-of-the-uuid/), released in 2017. This was possibly my first exposure to this idea. They're 36 bits larger than UUIDs or ULIDs, but otherwise very similar to ULIDs (and hence Julids) - * [ULIDs](https://github.com/ulid/spec), as previously discussed at length + * [ULIDs](https://github.com/ulid/spec), of course * [UUIDv7](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html#name-uuidv7-layout-and-bit-order); these are *very* similar to Julids; the primary difference is that the lower 62 bits are left up to the implementation, rather than always containing pseudorandom bits as in Julids (which use @@ -255,8 +255,9 @@ before](/rnd/one-part-serialized-mystery-part-2/#next-steps-with-ids): > and so my next step is to write one of those, and remove the ID generation logic from the > application. -So, is this the last time I'll time I'll be writing at length about these things? It's hard to say for -sure, but signs point to "yes". I hope you've found them at least a little interesting! +Now that I've accomplished all I've set out to, is this the last time I'll time I'll be writing at +length about these things? It's hard to say for sure, but signs point to "yes". I hope you've found +them at least a little interesting! # Thanks @@ -268,6 +269,13 @@ hours. Thank you, authors of those crates! Feel free to steal from this project! ---- +[^julid-package]: The Rust crate *package's* + [name](https://gitlab.com/nebkor/julid/-/blob/2484d5156bde82a91dcc106410ed56ee0a5c1e07/Cargo.toml#L2) + is "julid-rs"; that's the name you add to your `Cargo.toml` file, that's how it's listed on + [crates.io](https://crates.io/crates/julid-rs), etc. The crate's *library* + [name](https://gitlab.com/nebkor/julid/-/blob/2484d5156bde82a91dcc106410ed56ee0a5c1e07/Cargo.toml#L24) + is just "julid"; that's how you refer to it in a `use` statement in your Rust program. + [^monotonic]: At least, they will still have a total order if they're all generated within the same process in the same way; the code uses a [64-bit atomic integer](https://gitlab.com/nebkor/julid/-/blob/2484d5156bde82a91dcc106410ed56ee0a5c1e07/src/julid.rs#L11-12) @@ -284,4 +292,4 @@ hours. Thank you, authors of those crates! Feel free to steal from this project! a thousand at a time, so you could use the timestamp to look up what machine any given 10-bit ID referred to? -[marge ids]: ./marge_thinks_theyre_neat.png "marge simpson holding a potato labeled 'globally unique sortable identifiers'" +[marge ids]: ./marge_thinks_theyre_neat.png 'marge simpson holding a potato labeled "globally unique sortable identifiers"'