-
Notifications
You must be signed in to change notification settings - Fork 27
Types
A Proposal
is the subject on which all nodes need to reach consensus.
Proposal {
Payload []byte
Header []byte
Metadata []byte
VerificationSequence uint64
}
A View
has a designated leader and followers. It runs all three phases (prePrepare, prepare, and commit) on the proposals. It can abort on demand.
View {
Propose(p Proposal)
OnReceive(m Message)
Abort()
}
The Controller
runs the different views, proposes values and delivers the decisions. It also aborts views when they must be changed.
Controller {
ViewBuilder
View
ViewChanged(id int)
}
The ViewBuilder
helps Controller
building new views.
ViewBuilder {
BuildView(id int, members []int, d Decider, vc ViewChanger) View
}
The Decider
delivers the decisions (agreed proposals and signatures) to the Controller
.
Decider {
Decide(p Proposal, signatures []Signature)
}
The ViewChanger
collects the requests to change the current view and runs the view change protocol when needed. It informs the Controller
of the new view.
ViewChanger {
OnReceive(m Message)
}
The Timeouter
is used to track timing. It is started with a given duration and a function to call if the duration passes. When it is started it returns a cancel call to use if an abort of the timeout is required.
Timeouter {
StartTimer(Duration, func) Cancel
}
A Signature
used to prove that a node with a given Id
signed something.
Signature {
Id uint64
Value []byte
}
A RequestPool dispatches request submissions by the application layer, and tracks their inclusion into blocks, and raises a re-transmission of them to the cluster upon a first timeout, and complains to the view changer upon a second timeout.
RequestPool {
Submit(request []byte)
}
A LogEntry is an entry that the library wishes to be persisted in the Write Ahead Log (WAL). The TruncateBefore is a hint to the WAL that every LogEntry before can be safely erased.
LogEntry {
Value []byte
TruncateBefore bool
}