{"id":13494627,"url":"https://github.com/zhebrak/raftos","last_synced_at":"2025-09-09T14:05:27.919Z","repository":{"id":12340165,"uuid":"71641679","full_name":"zhebrak/raftos","owner":"zhebrak","description":"Asynchronous replication framework for distributed Python projects","archived":false,"fork":false,"pushed_at":"2023-06-05T16:47:22.000Z","size":101,"stargazers_count":341,"open_issues_count":9,"forks_count":54,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T08:02:43.215Z","etag":null,"topics":["asynchronous","python","raft","replication"],"latest_commit_sha":null,"homepage":"","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/zhebrak.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":"2016-10-22T13:44:15.000Z","updated_at":"2024-07-31T21:54:33.680Z","dependencies_parsed_at":"2024-07-31T22:08:42.215Z","dependency_job_id":null,"html_url":"https://github.com/zhebrak/raftos","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":0.08695652173913049,"last_synced_commit":"0d6f9e049b526279b1035f597291a96cf50c9b40"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhebrak%2Fraftos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhebrak%2Fraftos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhebrak%2Fraftos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhebrak%2Fraftos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhebrak","download_url":"https://codeload.github.com/zhebrak/raftos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234923,"owners_count":20905854,"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":["asynchronous","python","raft","replication"],"created_at":"2024-07-31T19:01:26.672Z","updated_at":"2025-04-04T19:13:00.558Z","avatar_url":"https://github.com/zhebrak.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# raftos\n\n[![Build Status](https://travis-ci.org/zhebrak/raftos.svg)](https://travis-ci.org/zhebrak/raftos) [![PyPI version](https://badge.fury.io/py/raftos.svg)](http://badge.fury.io/py/raftos)\n\nAsynchronous replication framework based on [Raft Algorithm](https://raft.github.io/) for fault-tolerant distributed systems.\n\n![](https://raw.github.com/zhebrak/raftos/master/docs/img/raft_rsm.png)\n\n#### Install\n\n```\npip install raftos\n```\n\n#### Register nodes on every server\n\n```python\nimport raftos\n\n\nloop.create_task(\n    raftos.register(\n        # node running on this machine\n        '127.0.0.1:8000',\n\n        # other servers\n        cluster=[\n            '127.0.0.1:8001',\n            '127.0.0.1:8002'\n        ]\n    )\n)\nloop.run_forever()\n```\n\n#### Data replication\n\n```python\ncounter = raftos.Replicated(name='counter')\ndata = raftos.ReplicatedDict(name='data')\n\n\n# value on a leader gets replicated to all followers\nawait counter.set(42)\nawait data.update({\n    'id': 337,\n    'data': {\n        'amount': 20000,\n        'created_at': '7/11/16 18:45'\n    }\n})\n```\n\n#### In case you only need consensus algorithm with leader election\n\n```python\nawait raftos.wait_until_leader(current_node)\n```\nor\n```python\nif raftos.get_leader() == current_node:\n    # make request or respond to a client\n```\nor\n```python\nraftos.configure({\n    'on_leader': start,\n    'on_follower': stop\n})\n```\n\nWhenever the leader falls, someone takes its place.\n\n\n[Paper](https://raft.github.io/raft.pdf) \u0026 [Video](https://www.youtube.com/watch?v=YbZ3zDzDnrw)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhebrak%2Fraftos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhebrak%2Fraftos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhebrak%2Fraftos/lists"}