Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 11 · From Scratch · Raft · with code: Go · about 12 min to read

Play it as a journeyTutor comes with a plan

Raft 04: A Key-Value Store on Top

Leader Election
Leader Election · Open board

The Scheduler build’s leader-election board, which says in one picture that something underneath has to answer “who is in charge, and is that still true”. Here the something is the log we just built, and the program on top is a store. Part of the Raft series, Build Your Own Raft.

Before you start. This series builds a small copy of Raft, the algorithm a group of machines uses to keep one shared list of commands. You have a leader election (Raft 01: Leader Election), a replicated log (Raft 02: Log Replication) and a log that survives restarts (Raft 03: Persistence). So far the commands were strings nobody read. This stage reads them: it makes a key-value store that a client can write to and read from, and answers the question the paper calls client interaction.

Lesson 81 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 23 June 2020: reads that came back empty
  • What a client needs that a log does not give
  • The state machine
  • The no-op
  • The clerk
  • Run it
  • The tests
  • Break it, twice

Terms it explains: Drop the duplicate check, Drop the no-op.

Related papers

Review From Scratch