Documentation
¶
Overview ¶
Package coord is a two-phase-commit coordinator for two participants. It asks for votes, retries once on timeout, and commits only when both participants voted yes. New can also build it with one of two known bugs, for the acceptance tests.
Index ¶
Constants ¶
const Participants = 2
Participants is the number of votes a commit needs.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions uint64
Actions is the set of things the holder must do after a transition, one bit each. The holder performs them in declaration order. The zero value is the empty set.
type Bug ¶
type Bug uint8
Bug selects a seeded defect. NoBug is the correct coordinator.
const ( NoBug Bug CommitOnTimeout // commits on a timeout after one yes vote SkipRecovery // returns from Retrying straight to Collecting )
Bug values.
type Event ¶
type Event uint8
Event is an input to Fire.
const ( EvStart Event EvYes EvNo EvTimeout EvResume )
Event values.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine is one coordinator. Build it with New and change it only with Fire.
func New ¶
New returns a coordinator in Init. Pass NoBug for the correct one, or a seeded bug for the acceptance tests.