Skip to content
/ flaken Public

Configurable bitwidth snowflake id generator, encoder, decoder for Rust

License

Notifications You must be signed in to change notification settings

teburd/flaken

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flaken

Build Status Coverage Status

A 64bit snowflake like id generator, encoder, and decoder which allows setting the bitwidths of each portion of the 64 bit encoded id.

let mut flake = Flaken::default().node(10).epoch(0).bitwidths(48, 12);
let id = flake.next();
let (timestamp, node, seq) = flake.decode(id);
assert!(timestamp > 0);
assert_eq!(node, 10);
assert_eq!(seq, 0);
assert_eq!(flake.encode(timestamp, node, seq), id);

About

Configurable bitwidth snowflake id generator, encoder, decoder for Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published