feat(raft-library): task 4.1 — sim data structures, raft_sim_init, dump_log; 2 tests
This commit is contained in:
parent
85a7e325a8
commit
d2e2c1ef8a
4 changed files with 349 additions and 2 deletions
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
- [ ] 4. (P) Deterministic N-node simulator (raft_sim.c)
|
||||
_Depends: 3_
|
||||
- [ ] 4.1 Implement simulator data structures and initialization
|
||||
- [x] 4.1 Implement simulator data structures and initialization
|
||||
- `raft_sim_node_t`: contains `raft_state_t state`, `raft_callbacks_t cbs`, `void *ctx` (points back to cluster), `int idx`, `int partition`, per-node event log buffer for `on_trace` capture
|
||||
- `raft_sim_cluster_t`: array of nodes up to `RAFT_SIM_MAX_NODES`, node count `n`, `leader_count` (incremented by each `on_become_leader` firing)
|
||||
- `raft_sim_init(cluster, n_nodes, election_timeout_ms)`: initializes `n` nodes with indices 0..n-1, priority=idx, wires `on_send_vote_request` to buffer the RPC for routing, wires `on_become_leader` to increment `leader_count`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue