Documentation ¶
Index ¶
- Constants
- func CalcDBOffset(ctx context.Context, db *sql.DB) (time.Duration, error)
- type App
- type DeadlineConfig
- type Handler
- func (h *Handler) Abort()
- func (h *Handler) CheckDBID(id string) bool
- func (h *Handler) CheckDBNextID(id string) bool
- func (h *Handler) Connect(ctx context.Context) (c driver.Conn, err error)
- func (h *Handler) DB() *sql.DB
- func (h *Handler) Driver() driver.Driver
- func (h *Handler) SetApp(app App)
- func (h *Handler) Status() *Status
- type State
- type Status
Constants ¶
const ( StateChannel = "goalert_switchover_state" ControlChannel = "goalert_switchover_control" DBIDChannel = "goalert_switchover_db_id" )
Postgres channel names
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 Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) CheckDBID ¶ added in v0.23.0
CheckDBID will return true if the ID matches the current db-next ID. If there is no current ID, then it is set and returns true.
func (*Handler) CheckDBNextID ¶ added in v0.23.0
CheckDBNextID will return true if the ID matches the current db-next ID. If there is no current ID, then it is set and returns true.