{"id":13565333,"url":"https://github.com/evertrue/monotone","last_synced_at":"2025-04-03T22:31:11.389Z","repository":{"id":22549766,"uuid":"25890788","full_name":"evertrue/monotone","owner":"evertrue","description":"A 64 bit monotonically increasing Id generator for distributed databases","archived":true,"fork":false,"pushed_at":"2015-10-28T13:49:03.000Z","size":272,"stargazers_count":7,"open_issues_count":5,"forks_count":1,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-04T18:46:43.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/evertrue.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":"2014-10-28T21:25:07.000Z","updated_at":"2024-07-01T04:34:12.000Z","dependencies_parsed_at":"2022-08-21T07:30:43.665Z","dependency_job_id":null,"html_url":"https://github.com/evertrue/monotone","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evertrue%2Fmonotone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evertrue%2Fmonotone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evertrue%2Fmonotone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evertrue%2Fmonotone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evertrue","download_url":"https://codeload.github.com/evertrue/monotone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247090061,"owners_count":20881912,"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":[],"created_at":"2024-08-01T13:01:44.834Z","updated_at":"2025-04-03T22:31:06.382Z","avatar_url":"https://github.com/evertrue.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"monotone\n========\n\nA 64 bit monotonically increasing Id generator for distributed databases.\n\n[![Build Status](https://travis-ci.org/evertrue/monotone.svg)](https://travis-ci.org/evertrue/monotone)\n\n# Purpose\nAs soon as you make a departure from an RDBMS for record based storage, you find yourself needing to generate Id's for those records as it's no longer afforded to you in most No-Sql stores.\n\nWe wanted to provide a simple solution to this that reused popular infrastructure that companies likely already have running. \n\n# Design\n\n* Monotone is a very simple wrapper around popular storage enginges capable of generating monotonically increasing id's that are not vulnerable to the challenges surrounding coorindated system clocks.\n\n* Underyling storage engine maven depdencies are scoped to `provided` so as to not pollute your depdendency tree for unused storage engine implementations.\n\n* A clean interface with fluent style builders and no checked exceptions is exposed to your codebase.\n\n* Monotone stores local ranges after it reserves them by incrementing a counter in the underlying storage engine implemtnation via atomic supported operations. This permits fast increments via a local `AtomicLong` in your application and only making a network hop when you have exhausted the local range.\n\n\n# ZooKeeper Support\n\n### Details \nYou may want to tune the `setMaxIdsToFetch` coniguration to your needs as this will dictate how frequent you have to do a write to ZK. \n\nThis implementation has an upper bound to its performance, even with a higher limit on `setMaxIdsToFetch` configured. This is mainly because the implementation does not use sharded counters. This is under consideration for future development.\n\nIf `setMaxAttempts` is reached, a `RuntimeException` is thrown. \n\n### Dead Simple Example\n```java\nIdGenerator gen = ZKGenerator.newBuilder(zkClient).build();             \nlong nextId = gen.nextId();\n```\n\n### Configuration Example\n```java\nIdGenerator gen = ZKGenerator.newBuilder(zkClient)\n                             .setCounterName(\"orders\")\n                             .setMaxIdsToFetch(1000)\n                             .setRootPath(\"/id_gen/my_app\")\n                             .build();\n                             \nlong nextId = gen.nextId();\n```\n\n### Configuration\n|Setting|Default Value|Description|\n|-------|:-------------:|-----------|\n|`setCounterName`|\"default\"|The name of your counter that will be stored in ZK. Cannot be null.|\n|`setMaxIdsToFetch`|1000|The number of Id's to reserve for a given local range. Needs to be greater than 0.|\n|`setRootPath`|\"/monotone/id_gen\"|The root path in ZK where the counter should live. Cannot be null.|\n|`setMaxAttempts`|5|The number of times an `incr` operation will occur if a failure response is given by ZK. Needs to be greater than 0.|\n\n# Redis Support\n\n# License\n[Free as in beer](https://github.com/evertrue/monotone/blob/master/LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevertrue%2Fmonotone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevertrue%2Fmonotone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevertrue%2Fmonotone/lists"}