{"id":15555819,"url":"https://github.com/breqdev/snowcloud","last_synced_at":"2025-03-29T02:46:18.667Z","repository":{"id":115366252,"uuid":"385443111","full_name":"breqdev/snowcloud","owner":"breqdev","description":"Service for generating unique, time-ordered IDs across distributed worker processes.","archived":false,"fork":false,"pushed_at":"2022-09-03T18:16:20.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T12:53:13.407Z","etag":null,"topics":["flask","redis"],"latest_commit_sha":null,"homepage":"https://breq.dev/projects/snowflake","language":"Python","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/breqdev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-13T02:04:05.000Z","updated_at":"2023-03-07T09:24:37.000Z","dependencies_parsed_at":"2023-06-03T02:45:44.346Z","dependency_job_id":null,"html_url":"https://github.com/breqdev/snowcloud","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"79c23ae5b5211e76bf4771872476f3d3983b0a29"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breqdev%2Fsnowcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breqdev%2Fsnowcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breqdev%2Fsnowcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breqdev%2Fsnowcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/breqdev","download_url":"https://codeload.github.com/breqdev/snowcloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131246,"owners_count":20728299,"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":["flask","redis"],"created_at":"2024-10-02T15:10:44.729Z","updated_at":"2025-03-29T02:46:18.641Z","avatar_url":"https://github.com/breqdev.png","language":"Python","readme":"# snowcloud\n\nSnowcloud is a service for generating unique, time-ordered, 64-bit IDs across distributed worker processes. This format is commonly called \"snowflake\" IDs, and is used by [Twitter](https://blog.twitter.com/engineering/en_us/a/2010/announcing-snowflake) and [Discord](https://discord.com/developers/docs/reference#snowflakes).\n\n## Snowflake ID Format\n\n| Timestamp | Worker ID | Increment |\n| --------- | --------- | --------- |\n| 42 bits   | 10 bits   | 12 bits   |\n| milliseconds since Jan 1, 2020 | allocated by delegator | incremented by generator |\n\n## Snowcloud Deployment Structure\n\nA Snowcloud deployment consists of a *delegator* and many *generators*.\n\n### Delegator\n\nThe delegator (located in `snowcloud/delegator.py`, run with e.g. `python3 -m snowcloud.delegator`) keeps track of assigning worker IDs to different generator processes. It uses [Redis](https://redis.io) to keep track of a pool of worker IDs. It then allows clients to register for a worker ID or renew their existing worker ID.\n\n### Generators\n\nGenerators obtain a worker ID from the delegator and use it to generate their own Snowflake IDs. These can be integrated into Flask applications using the `snowcloud.flask_ext` module.\n\nAn example Flask server is located in `snowcloud/server.py`. However, more commonly, the Flask application would use the Snowflake ID internally instead. For instance, it could generate a Snowflake ID to use as the primary key column whenever it inserts a new row into the database.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreqdev%2Fsnowcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbreqdev%2Fsnowcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreqdev%2Fsnowcloud/lists"}