{"id":28075270,"url":"https://github.com/trevatk/tinyraft","last_synced_at":"2025-08-23T15:16:46.880Z","repository":{"id":292287954,"uuid":"979883421","full_name":"trevatk/tinyraft","owner":"trevatk","description":"Stateless Raft","archived":false,"fork":false,"pushed_at":"2025-05-09T17:35:19.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T00:55:44.065Z","etag":null,"topics":["golang","raft-consensus-algorithm","tinyraft"],"latest_commit_sha":null,"homepage":"","language":"Go","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/trevatk.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,"zenodo":null}},"created_at":"2025-05-08T08:10:49.000Z","updated_at":"2025-05-09T17:35:18.000Z","dependencies_parsed_at":"2025-05-09T06:29:04.790Z","dependency_job_id":null,"html_url":"https://github.com/trevatk/tinyraft","commit_stats":null,"previous_names":["trevatk/tinyraft"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trevatk%2Ftinyraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trevatk%2Ftinyraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trevatk%2Ftinyraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trevatk%2Ftinyraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trevatk","download_url":"https://codeload.github.com/trevatk/tinyraft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850890,"owners_count":21973672,"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":["golang","raft-consensus-algorithm","tinyraft"],"created_at":"2025-05-13T00:55:49.620Z","updated_at":"2025-05-13T00:55:50.231Z","avatar_url":"https://github.com/trevatk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny Raft\n\nA raft built with server and transport modules only. \n\nBring your own state machine.\n\n## Install\n\nCurrently only a package level import is supported. Other entrypoints are planned for future development. Currently you can install using command:\n\n```bash\ngo get github.com/trevatk/tinyraft\n```\n\n## Quick Start\n\n```golang\n\n// required env variables\n// also found in the Makefile\n//\n// NODE_ID=\"00000000-0000-0000-0000-000000000000\"\n// NODE_ADVERTISE_ADDR=\":50051\"\n// NODE_LISTEN_ADDR=\":50051\"\n// RAFT_BOOTSTRAP=\"true\"\n// RAFT_DATA_DIR=\"data/00000000-0000-0000-0000-000000000000\"\n\ntype wordTracker struct {\n\tmtx   sync.Mutex\n\twords []string\n}\n\n// interface compliance\n// raft leader will call Apply when new entries are added\nvar _ tinyraft.Module = (*wordTracker)(nil)\n\n// Apply module implementation when receiving log payload from raft\nfunc (wt *wordTracker) Apply(cmd []byte) error {\n\twt.mtx.Lock()\n\tdefer wt.mtx.Unlock()\n\n\tw := string(cmd)\n\twt.words = append(wt.words, w)\n\treturn nil\n}\n```\n\nFull [Example](./examples/raft.go)\n\n## Design\n\nFrom a high level perspective there are three objects used to create, start/stop, and interact with the raft `Caller`, `Raft`, and `Module`. \n\n### Caller\n\nClient side interaction with the raft. From the `examples/raft.go` a client side `gRPC` call is made to `apply` a command to the raft. Essentially calling to the raft leader and telling it to apply the command to all nodes. Arriving at name `caller`. left side of `figure1-1`.\n\n### Raft\n\nThis is the `raft` itself responsible for replicating commands across all nodes. \n\n### Module\n\n![figure(1-1)](docs/figure-1.png)\n\n## Terminology\n\n`Caller` : `client` implementation. Should be used to interact with your `raft`. Uses `gRPC` policies to `wait-for-ready` and `retry`.  \n\n`Module` : used by `raft.Server` to implementation module wrapper.\n\n`Server` : server side implementation to be used with existing `server` code. `Start` and `Shutdown` should be with application lifecyle code.\n\n`State Machine` : storage of log entries. NOT INCLUDED.\n\n## References\n\n- [hashicorp/raft](https://github.com/hashicorp/raft)\n- [raft consensus](https://raft.github.io/raft.pdf)\n- [raft gRPC](https://github.com/Jille/raft-grpc-example)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrevatk%2Ftinyraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrevatk%2Ftinyraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrevatk%2Ftinyraft/lists"}