Implement Raft storage component
Extracted from !7553 (merged). This MR adds the architectural documentation and the implementation of Raft persistent storage.
The document is a brief summary of Gitaly's multi-raft architecture. It provides guidance for this and subsequent MRs. During the active development phase, the document is highly subject to change. When things stabilize a bit, it will be converted to a proper technical document in the doc/
directory.
The main target of this MR is raftmgr.Storage
. For high-level design, please visit the parent's MR description and the attached design doc.
In summary, it implements raft.Storage interface for etcd/raft to access persisted log entries and metadata. It encapsulates all interaction between the upcoming Raft Manager and local log.Manager
. Two notes:
- In the hard state provided by etcd/raft state machine, the committed index (let's called it committedLSN) is crucial. It tracks the latest LSN (Log Sequence Number) acknowledged by the Raft group's quorum. This index complements the existing appendedLSN managed by log.Manager.
- Persist Raft metadata as
RAFT
file inside the log entry directory.