{"id":22685376,"url":"https://github.com/progamesigner/snowflakes-gem","last_synced_at":"2025-03-29T15:15:15.674Z","repository":{"id":50353701,"uuid":"93589380","full_name":"progamesigner/snowflakes-gem","owner":"progamesigner","description":"A decentralized, k-ordered UUID generator in Ruby","archived":false,"fork":false,"pushed_at":"2017-06-07T04:05:37.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T19:42:53.708Z","etag":null,"topics":["ntp","ruby","snowflake"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/progamesigner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-07T03:39:27.000Z","updated_at":"2022-07-28T12:27:36.000Z","dependencies_parsed_at":"2022-09-14T19:10:14.860Z","dependency_job_id":null,"html_url":"https://github.com/progamesigner/snowflakes-gem","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progamesigner%2Fsnowflakes-gem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progamesigner%2Fsnowflakes-gem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progamesigner%2Fsnowflakes-gem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progamesigner%2Fsnowflakes-gem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/progamesigner","download_url":"https://codeload.github.com/progamesigner/snowflakes-gem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246200323,"owners_count":20739566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ntp","ruby","snowflake"],"created_at":"2024-12-09T22:14:37.136Z","updated_at":"2025-03-29T15:15:15.641Z","avatar_url":"https://github.com/progamesigner.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snowflakes\n\nSnowflakes is a [Ruby](https://www.ruby-lang.org/) gem that provides:\n * A simple 128-bit id generator.\n * Methods to convert snowflakes ID into string\n\nSnowflakes produces 128-bit and time-ordered ids. They run one on each node in infrastructure and will generate conflict-free ids on-demand without coordination.\n\nThe project is inspired by [Twitter's Snowflake](https://github.com/twitter/snowflake) and [Go implementation of Discord](https://github.com/bwmarrin/snowflake) but extended to 128-bit and not compatible with Twitter's Snowflake. This library provides a basis for id generation but not a service for handing out ids nor node id coordination.\n\n## Getting Started\n\n### Installation\n\n```sh\ngem install snowflakes\n```\n\nOr via bundler:\n```\nsource 'https://rubygems.org'\n\ngem 'snowflakes'\n```\n\n### Usage\n\n```ruby\nnode = Snowflakes::Node.new(ENV['SNOWFLAKE_ID'])\n\nsome_id = node.next.to_hex\n```\n\n### Format\n\nSnowflakes ids are 128-bits wide described here from most significant to least significant bits:\n* timestamp (64-bit) - milliseconds since the epoch (Jan 1 1970)\n* node id(48-bit) - a configurable node id\n* sequence (16-bit) - usually 0, increasing when more than one request in the same millisecond and reset to 0 when clock ticks forward\n\n#### System Clock Dependency\n\nYou should use NTP to keep your system clock accurate. Snowflakes holds requests when non-monotonic clock detected. To run in a mode where NTP not move the clock backwards, see http://wiki.dovecot.org/TimeMovedBackwards#Time_synchronization for tips on how to do this.\n\n## Related Projects\n\n* [progamesigner/snowflakes-php](https://github.com/progamesigner/snowflakes-php)\n\n## Maintainers\n\n[@progamesigner](https://github.com/progamesigner).\n\n## Contribute\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Commit** changes to your own branch\n 4. **Push** your work back up to your fork\n 5. Submit a **Pull request** so that I can review your changes\n\n## License\n[MIT](LICENSE) © Yang Sheng Han\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogamesigner%2Fsnowflakes-gem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogamesigner%2Fsnowflakes-gem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogamesigner%2Fsnowflakes-gem/lists"}