https://github.com/sazid/fireflake
🔥Fireflake - implementation of Snowflake ID in Mojo.
https://github.com/sazid/fireflake
distributed id-generator mojo python snowflake snowflake-id
Last synced: 2 months ago
JSON representation
🔥Fireflake - implementation of Snowflake ID in Mojo.
- Host: GitHub
- URL: https://github.com/sazid/fireflake
- Owner: sazid
- License: apache-2.0
- Created: 2024-09-29T12:06:40.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-29T12:29:03.000Z (8 months ago)
- Last Synced: 2025-01-23T12:16:13.361Z (4 months ago)
- Topics: distributed, id-generator, mojo, python, snowflake, snowflake-id
- Language: Mojo
- Homepage:
- Size: 3.36 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 🔥 Fireflake
Implementation of [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) for
Mojo 🔥.
![]()
🔥 Fireflake
![Written in Mojo][language-shield]
[![Apache-2.0 license][license-shield]][license-url]
![Build status][build-shield]
[![Contributors Welcome][contributors-shield]][contributors-url]
## Requirements
- Mojo: `mojo 24.5.0 (e8aacb95)`. Should work in future versions.
- Python: `3.7+`## Getting started
1. 🌩️ Download `fireflake.mojopkg` from [releases](https://github.com/sazid/fireflake/releases).
2. 🗄️ Place it in your project working directory.
3. 📝 Follow the usage guideline below.## Usage
```python
from fireflake import Fireflakefn main() raises:
# Generate new id with default config - Twitter/X style Snowflake ID.
fireflake = Fireflake()
new_id = fireflake.generate()
print(new_id)# Generate new id with custom config for nodes/sequence bit count.
fireflake2 = Fireflake[node_bits_count=7, sequence_bits_count=15]()
new_id = fireflake2.generate()
print(new_id)# Generate new id with default config but provide a custom number - which
# could be hash of your data or any other meaningful number you select.
fireflake3 = Fireflake()
new_id = fireflake3.generate(1234)
print(new_id)
```### Check out other Mojo libraries:
- HTTP framework - [@saviorand/lightbug_http](https://github.com/saviorand/lightbug_http)
- Logging - [@toasty/stump](https://github.com/thatstoasty/stump)
- CLI and Terminal - [@toasty/prism](https://github.com/thatstoasty/prism), [@toasty/mog](https://github.com/thatstoasty/mog)
- Date/Time - [@mojoto/morrow](https://github.com/mojoto/morrow.mojo) and [@toasty/small-time](https://github.com/thatstoasty/small-time)[build-shield]: https://img.shields.io/github/actions/workflow/status/sazid/fireflake/.github%2Fworkflows%2Fpackage.yml
[language-shield]: https://img.shields.io/badge/language-mojo-orange
[license-shield]: https://img.shields.io/github/license/sazid/fireflake?logo=github
[license-url]: https://github.com/sazid/fireflake/blob/main/LICENSE
[contributors-shield]: https://img.shields.io/badge/contributors-welcome!-blue
[contributors-url]: https://github.com/sazid/fireflake#contributing
[discord-url]: https://discord.gg/VFWETkTgrr