Documentation
¶
Index ¶
Constants ¶
const ( StateChannel = "goalert_switchover_state" ControlChannel = "goalert_switchover_control" )
const ( StateStarting = State("starting") StateReady = State("ready") StateArmed = State("armed") StateArmWait = State("armed-waiting") StatePausing = State("pausing") StatePaused = State("paused") StatePauseWait = State("paused-waiting") StateComplete = State("complete") StateAbort = State("aborted") )
Possible states
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeadlineConfig ¶
type DeadlineConfig struct {
BeginAt time.Time // The start-time of the Switch-Over.
ConsensusTimeout time.Duration // Amount of time to wait for consensus amongst all nodes before aborting.
PauseDelay time.Duration // How long to wait after starting before beginning the global pause.
PauseTimeout time.Duration // Timeout to achieve global pause before aborting.
MaxPause time.Duration // Absolute maximum amount of time for any operation to be delayed due to the Switch-Over.
NoPauseAPI bool // Allow HTTP/API requests during Pause phase.
}
DeadlineConfig controls the timeing of a Switch-Over operation.
func ConfigFromContext ¶
func ConfigFromContext(ctx context.Context) DeadlineConfig
ConfigFromContext returns the DeadlineConfig associated with the current context.
func DefaultConfig ¶
func DefaultConfig() DeadlineConfig
DefaultConfig returns the default deadline configuration.
func ParseDeadlineConfig ¶
func ParseDeadlineConfig(s string, offset time.Duration) (*DeadlineConfig, error)
ParseDeadlineConfig will parse deadline configuration (given by Serialize) from a string. Offset should be the time difference between the local clock and the central clock (i.e. Postgres).
func (DeadlineConfig) AbsoluteDeadline ¶
func (cfg DeadlineConfig) AbsoluteDeadline() time.Time
AbsoluteDeadline will calculate the absolute deadline of the entire switchover operation.
func (DeadlineConfig) ConsensusDeadline ¶
func (cfg DeadlineConfig) ConsensusDeadline() time.Time
ConsensusDeadline will return the deadline for consensus amonst all nodes.
func (DeadlineConfig) PauseAt ¶
func (cfg DeadlineConfig) PauseAt() time.Time
PauseAt will return the time global pause begins.
func (DeadlineConfig) PauseDeadline ¶
func (cfg DeadlineConfig) PauseDeadline() time.Time
PauseDeadline will return the deadline to achieve global pause.
type Status ¶
type Status struct {
NodeID string
State State
Offset time.Duration
At time.Time
ActiveRequests int
// contains filtered or unexported fields
}
Status represents the status of an individual node.
func ParseStatus ¶
func (Status) MatchDBNext ¶
MatchDBNext will return true if the Status indicates a matching db-next-url.