Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ybt195/flake
Generate k-sortable 64-bit unique flake ids.
https://github.com/ybt195/flake
distributed-systems flake-ids go golang k-sortable raft
Last synced: 3 months ago
JSON representation
Generate k-sortable 64-bit unique flake ids.
- Host: GitHub
- URL: https://github.com/ybt195/flake
- Owner: ybt195
- License: apache-2.0
- Created: 2018-10-06T01:37:46.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-15T18:08:41.000Z (about 5 years ago)
- Last Synced: 2024-06-21T20:55:19.051Z (5 months ago)
- Topics: distributed-systems, flake-ids, go, golang, k-sortable, raft
- Language: Go
- Homepage:
- Size: 166 KB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-golang-repositories - flake - sortable 64-bit unique flake ids. (Repositories)
README
Flake
Generate k-sortable 64-bit unique flake ids.
Issues
·
Documentation
## Table of contents
- [Overview](#overview)
- [Contributing](#contributing)
- [License](#license)## Overview
Flake ids are represented in 64-bit unsigned integers. Ids can be broken down into three components:
- Bucket: A 10-bit bucket id for sharding ids over 1024 different buckets.
- Timestamp: A 42-bit millisecond encoded timestamp of when the id was generated.
- Sequence: A 12-bit incrementing sequence number that is reset at each timestamp increment.With this formation, flake can generate 4096 unique ids per millisecond per bucket, or in other words, 4 **billion** unique ids per second. For reference, YouTube gets about 75 **thousand** unique views per second.
## Contributing
Contributions are very much welcomed. Please read the [Contribution Guide](CONTRIBUTING.md) for how to get started.
Note that all contributors are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md).
## License
Flake is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). For more information, see the [License](LICENSE) file.