{"id":20516372,"url":"https://github.com/chloro-pn/raft","last_synced_at":"2025-10-11T00:11:11.393Z","repository":{"id":120001517,"uuid":"339105058","full_name":"chloro-pn/raft","owner":"chloro-pn","description":"raft based on asio / c++14","archived":false,"fork":false,"pushed_at":"2021-02-27T10:15:38.000Z","size":220,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T23:59:21.500Z","etag":null,"topics":["asio","cpp","raft"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chloro-pn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-15T14:34:20.000Z","updated_at":"2021-02-27T10:15:40.000Z","dependencies_parsed_at":"2023-06-14T16:15:19.720Z","dependency_job_id":null,"html_url":"https://github.com/chloro-pn/raft","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chloro-pn/raft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chloro-pn%2Fraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chloro-pn%2Fraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chloro-pn%2Fraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chloro-pn%2Fraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chloro-pn","download_url":"https://codeload.github.com/chloro-pn/raft/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chloro-pn%2Fraft/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005645,"owners_count":26083940,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asio","cpp","raft"],"created_at":"2024-11-15T21:28:32.901Z","updated_at":"2025-10-11T00:11:11.377Z","avatar_url":"https://github.com/chloro-pn.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raft\nraft based on asio / c++14\n\n#### [2021-2-25]\n* 修复同一个term内可能选出多于1个leader的严重bug\n* 修复election timeout周期时间过短的bug\n* 完成每个状态下处理各种信息的逻辑\n* 添加了关于客户端提交command相关的消息类型\n\n##### TODO:\n* 完成客户端数据提交的逻辑\n\n#### [2021-2-26]\n* 为了便于实现和逻辑的清晰，将心跳包区别于append entries，增加字段hear_beat\n\n#### [2021-2-27]\n* 完成log的接口，但是只提供了内存存储的实现。\nTODO:\n* 在完成了选主和日志复制的基本逻辑之后，需要完成以下部分的逻辑：\n1. 节点的状态持久化，目前只是将日志存储在内存中\n2. 节点的加入，退出机制，加入包括新的节点加入和crash节点重启\n3. 快照机制（优先级靠后，作为算法优化机制可以最后再实现）\n4. pre-vote\n5. 保证读的强一致性，需要注意的两个机制：leader在每次被选举出来需要同步一个本term的command，\n并将其之前的所有日志应用到状态机后，才能提供读服务；leader需要实现租赁机制，确保分区产生时不存在\n两个leader同时服务的可能。\n6. 保证写的幂等性，注意raft不保证每个command只被执行一次（实际上只要涉及WAL和不可靠网络通信，就无法存在exactly-once保证）\n\n参考url：\n\nhttps://www.zhihu.com/question/302761390\n\nhttps://segmentfault.com/a/1190000038171007?utm_source=tag-newest\n\nhttps://segmentfault.com/a/1190000038170990?utm_source=tag-newest\n\nhttps://zhuanlan.zhihu.com/p/130245819\n\nhttps://zhuanlan.zhihu.com/p/113149149\n\nhttps://zhuanlan.zhihu.com/p/64405742\n\nhttps://zhuanlan.zhihu.com/p/22820761\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchloro-pn%2Fraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchloro-pn%2Fraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchloro-pn%2Fraft/lists"}