orbit-id
Rust implementation of Orbit ID.
- v2 (crate root /
orbit_id::v2): Stable unsigned 128-bit, time-sortable IDs - v1 (
orbit_id::v1): stable unsigned 64-bit, time-sortable IDs
Consumer migration: 1.x → 2.0.0. Registry 2.0.0 cut is slice J of the promotion plan.
Install
[]
= "1"
Publishing: crates.io publishing · Cross-registry versioning.
API
use ;
use v1;
let v2_id = new
.unwrap
.generate
.unwrap;
assert_eq!;
let fields = OrbitFields ;
let encoded = encode.unwrap;
assert_eq!;
let v1 = encode.unwrap;
assert_eq!;
Use from_decimal_string, to_decimal_string, parse, to_hex_string, and
is_valid for canonical decimal string handling (v1 equivalents live under
orbit_id::v1).
OrbitGenerator is synchronous and internally synchronized with a Mutex.
Layout
v2:
formatVersion: 4 | timestamp: 48 | type: 16 | node: 16 | sequence: 16
| region: 4 | tenant: 16 | reserved: 8
v1:
timestamp: 41 bits | type: 6 bits | node: 7 bits | sequence: 10 bits
The crate validates the shared fixtures in
../../spec/conformance/ with cargo test.
License
Apache-2.0. See LICENSE.