How it works...
When the application starts, we initialize multiple Raft objects. These each have their own address and transport. The InmemTransport{} function also provides a method to connect the other transports called Connect(). Once these connections are established, the Raft cluster holds an election. When communicating to a Raft cluster, clients must communicate with the leader. In our case, one handler can talk to all of the nodes, so the handler is responsible for having the leader Raft object call Apply(). This in turn runs apply() on all of the other nodes. This recipe does not deal with snapshots and is only concerned with FSM state changes. The InmemTransport{} function simplifies the election and bootstrapping process by allowing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access