{"id":17194914,"url":"https://github.com/ajermakovics/crdts","last_synced_at":"2025-04-13T20:21:38.384Z","repository":{"id":24275314,"uuid":"27669770","full_name":"ajermakovics/crdts","owner":"ajermakovics","description":"Simple Conflict-free Replicated Data Types (CRDTs) for Java","archived":false,"fork":false,"pushed_at":"2017-01-29T07:43:32.000Z","size":20,"stargazers_count":35,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T10:51:16.454Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ajermakovics.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-12-07T12:41:14.000Z","updated_at":"2025-01-14T04:27:41.000Z","dependencies_parsed_at":"2022-08-22T14:40:48.358Z","dependency_job_id":null,"html_url":"https://github.com/ajermakovics/crdts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Fcrdts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Fcrdts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Fcrdts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Fcrdts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajermakovics","download_url":"https://codeload.github.com/ajermakovics/crdts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248776207,"owners_count":21159742,"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-10-15T01:48:37.306Z","updated_at":"2025-04-13T20:21:38.356Z","avatar_url":"https://github.com/ajermakovics.png","language":"Java","funding_links":[],"categories":["分布式开发"],"sub_categories":["微服务框架"],"readme":"CRDTs \n================\n\nSimple [Conflict-free Replicated Data Types](http://en.wikipedia.org/wiki/Conflict-free_replicated_data_type) (CRDTs) for distributed systems. CRDTs on different replicas can diverge from one another but at the end they can be safely merged providing an eventually consistent value. In other words, CRDTs have a **merge** method that is *idempotent*, *commutative* and *associative*.\n\nThe following CRDTs are currently implemented:\n - G-Counter - Grow only counter\n - PN-Counter - Increment/decrement counter \n - G-Set - Grow only set. Allows only adds\n - 2P-Set - Two Phase Set. Allows adds and removes but an item can be removed only once\n - OR-Set- Ovserved-Removed Set. Allows multiple adds and removes. Adds win in case of a conflict during merge.\n\nExamples\n===========\nPN-Counter:\n```java\n        PNCounter\u003cString\u003e replica1 = new PNCounter\u003c\u003e();\n        replica1.increment(\"hostname1\");\n        \n        PNCounter\u003cString\u003e replica2 = replica1.copy();\n\n        replica1.increment(\"hostname2\");\n        replica2.decrement(\"hostname2\");\n        \n        replica1.merge( replica2 ); \n        replica1.get(); // counter is 1\n```\n2-P Set:\n```java\n\tTwoPSet\u003cString\u003e replica1 = new TwoPSet\u003c\u003e();\n\n\treplica1.add(\"a\");\n\treplica1.add(\"b\");\n        \n\tTwoPSet\u003cString\u003e replica2 = replica1.copy();\n\treplica2.remove(\"b\");\n\treplica2.add(\"c\");\n\n\treplica1.merge(replica2); \n\treplica1.get(); // set is {\"a\", \"c\"}\n```\n\nDownload\n========\n\nMaven/Gradle dependency: https://jitpack.io/#ajermakovics/crdts\n\n\nSerialization\n===========\n\nAll CRDT classes implement Java Serializable but you should be able to use any other library.\n\nRequirements\n============\n\nJava 1.6  \nThe only dependency is Google Guava\n\nMore info\n=========\n - http://book.mixu.net/distsys/eventual.html\n - [A comprehensive study of\nConvergent and Commutative Replicated Data Types](http://hal.upmc.fr/file/index/docid/555588/filename/techreport.pdf)\n\nLicense\n=======\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajermakovics%2Fcrdts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajermakovics%2Fcrdts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajermakovics%2Fcrdts/lists"}