{"id":13877962,"url":"https://github.com/copiousfreetime/torid","last_synced_at":"2025-06-14T22:09:59.952Z","repository":{"id":18353454,"uuid":"21533411","full_name":"copiousfreetime/torid","owner":"copiousfreetime","description":"Temporally Ordered IDs. Generate universally unique identifiers (UUID) that sort lexically in time order.","archived":false,"fork":false,"pushed_at":"2024-03-07T06:13:40.000Z","size":84,"stargazers_count":27,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-02T15:52:14.771Z","etag":null,"topics":["ruby","temporal-data","uuid"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/copiousfreetime.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","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":"2014-07-06T04:20:16.000Z","updated_at":"2024-07-13T15:49:37.000Z","dependencies_parsed_at":"2024-03-06T08:28:45.349Z","dependency_job_id":"a1bf3a9a-78f6-4d12-a7d6-ab8478ab7fc4","html_url":"https://github.com/copiousfreetime/torid","commit_stats":{"total_commits":68,"total_committers":1,"mean_commits":68.0,"dds":0.0,"last_synced_commit":"045938a72dd10a54445b080a8e71404af8eb3099"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copiousfreetime%2Ftorid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copiousfreetime%2Ftorid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copiousfreetime%2Ftorid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copiousfreetime%2Ftorid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/copiousfreetime","download_url":"https://codeload.github.com/copiousfreetime/torid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copiousfreetime%2Ftorid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258190173,"owners_count":22662444,"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":["ruby","temporal-data","uuid"],"created_at":"2024-08-06T08:01:36.116Z","updated_at":"2025-06-14T22:09:59.925Z","avatar_url":"https://github.com/copiousfreetime.png","language":"Ruby","readme":"## Torid\n\n[![Build Status](https://copiousfreetime.semaphoreci.com/badges/torid/branches/main.svg)](https://copiousfreetime.semaphoreci.com/projects/torid)\n\n* [Homepage](https://github.com/copiousfreetime/torid/)\n* [Github Project](https://github.com/copiousfreetime/torid)\n\n## DESCRIPTION\n\nTemporally Ordered IDs. Generate universally unique identifiers (UUID)\nthat sort lexically in time order.\n\n## DETAILS\n\nTorid exists to solve the problem of generating UUIDs that when ordered\nlexically, they are also ordered temporally. I needed a way to generate ids for\nevents that are entering a system with the following criteria:\n\n1. Fast ID generation\n2. No central coordinating server/system\n3. No local storage\n4. Library code, that is multiple apps on the same machine can use the same code\n   and they will not generate duplicate ids\n5. Eventually stored in a UUID field in a database. So 128bit ids are totally\n   fine.\n\nThe IDs that Torid generates are 128bit IDs made up of 2, 64bit parts.\n\n* 64bit microsecond level UNIX timestamp\n* 64bit hash of the system hostname, process id and a random value.\n\n## EXAMPLES\n\n#### Using the defaults\n\n```ruby\nrequire 'torid'\n\nuuid = Torid.uuid\nuuid.to_s         # =\u003e \"0004fda4-318e-f380-5a45-5321cd065b02\"\nuuid.bytes        # =\u003e \"\\x00\\x04\\xFD\\xA41\\x8E\\xF3\\x80ZES!\\xCD\\x06[\\x02\"\n```\n\n#### Using your own instance of a Generator\n\n```ruby\nrequire 'torid'\n\ngenerator = Torid::Generator.new\nuuid      = generator.next\n\nuuid.to_s        # =\u003e \"0004fda4-3f42-3d01-4731-5a4aa8ddd6c3\"\nuuid.bytes       # =\u003e \"\\x00\\x04\\xFD\\xA4?B=\\x01G1ZJ\\xA8\\xDD\\xD6\\xC3\"\n```\n\n## CREDITS / RESOURCES\n\nThe vast majority of the credit and research stems from:\n\n* [jondot's](https://github.com/jondot) blog post on [Fast ID Generation](http://blog.paracode.com/2012/04/16/fast-id-generation-part-1/) served to solidify my thoughts on the criteria I needed in an ID generation system. \n* This let me to [Boundary's Flake](http://boundary.com/blog/2012/01/12/flake-a-decentralized-k-ordered-unique-id-generator-in-erlang/)\n* [James Golick's](https://github.com/jamesgolick) [lexical_uuid](https://github.com/jamesgolick/lexical_uuid), which if I had found a day earlier, I might be using instead of creating this.\n\nYou could consider Torid to be a reimplementation of [lexical_uuid](https://github.com/jamesgolick/lexical_uuid). It definately steals some code from it and [simple_uuid](https://github.com/cassandra-rb/simple_uuid)\n\nBlog posts around ID generation:\n\n* [Wikipedia UUID](http://en.wikipedia.org/wiki/Universally_unique_identifier)\n* [RFC 4122](http://tools.ietf.org/html/rfc4122)\n* [Fast ID Generation Part I](http://blog.paracode.com/2012/04/16/fast-id-generation-part-1/)\n* [Boundary's Flake Project](http://boundary.com/blog/2012/01/12/flake-a-decentralized-k-ordered-unique-id-generator-in-erlang/)\n* [Flickr's Ticket Server](http://code.flickr.net/2010/02/08/ticket-servers-distributed-unique-primary-keys-on-the-cheap/)\n* [Twitter Snowflake](https://blog.twitter.com/2010/announcing-snowflake)\n* [Sharding \u0026 ID's at Instagram](http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram)\n\nLibraries implementing similar approaches:\n\n* [simple_uuid](https://github.com/cassandra-rb/simple_uuid)\n* [uuid](https://github.com/assaf/uuid)\n* [flake](http://github.com/boundary/flake)\n* [BSON Object ID](https://github.com/mongodb/bson-ruby/blob/master/lib/bson/object_id.rb) and in [C](https://github.com/mongodb/bson-ruby/blob/master/ext/bson/native.c)\n* [ffi-uuid](https://github.com/mmullis/ffi-uuid)\n* [lexical_uuid](https://github.com/jamesgolick/lexical_uuid)\n\n## ISC LICENSE\n\nhttp://opensource.org/licenses/isc-license.txt\n\nCopyright (c) 2014 Jeremy Hinegardner\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice\nand this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopiousfreetime%2Ftorid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcopiousfreetime%2Ftorid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopiousfreetime%2Ftorid/lists"}