Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StateFnMap = map[StateId]StateFn{} ValidStates = []StateId{ StateOK, StateFailWait, StatePassWait, StateFail, StateWarn, } )
Functions ¶
func AddHook ¶
func AddHook(hook TransitionHook)
func AddStateHook ¶
func AddStateHook(id StateId, hook TransitionHook)
Types ¶
type ResultMemo ¶
type ResultMemo struct { CheckId string `json:"check_id" db:"check_id"` CustomerId string `json:"customer_id" db:"customer_id"` BastionId string `json:"bastion_id" db:"bastion_id"` FailingCount int32 `json:"failing_count" db:"failing_count"` ResponseCount int `json:"response_count" db:"response_count"` LastUpdated time.Time `json:"last_updated" db:"last_updated"` }
func ResultMemoFromCheckResult ¶
func ResultMemoFromCheckResult(result *schema.CheckResult) *ResultMemo
type State ¶
type State struct { CheckId string `json:"check_id" db:"check_id"` CustomerId string `json:"customer_id" db:"customer_id"` Id StateId `json:"state_id" db:"state_id"` State string `json:"state_name" db:"state_name"` TimeEntered time.Time `json:"time_entered" db:"time_entered"` LastUpdated time.Time `json:"last_updated" db:"last_updated"` MinFailingCount int32 `json:"min_failing_count" db:"min_failing_count"` MinFailingTime time.Duration `json:"min_failing_time" db:"min_failing_time"` FailingCount int32 `json:"failing_count" db:"failing_count"` ResponseCount int32 `json:"response_count" db:"response_count"` }
State represents what we know about a given Check based on a collection of CheckResults from bastions.
func (*State) TimeInState ¶
func (*State) Transition ¶
func (state *State) Transition(result *schema.CheckResult) error
Transition is the transition function for the Check state machine. Given a proposed change to the current state (a new CheckResult object), update the state for the check associated with the result.
type StateTransitionLogEntry ¶
type StateTransitionLogEntry struct { Id int64 `json:"id" db:"id"` CheckId string `json:"check_id" db:"check_id"` CustomerId string `json:"customer_id" db:"customer_id"` From StateId `json:"from_state" db:"from_state"` To StateId `json:"to_state" db:"to_state"` CreatedAt time.Time `json:"created_at" db:"created_at"` }
StateTransitionLogEntry is a record of a transition from one state (From) to another state (To).
type TransitionHook ¶
type TransitionHook func(newStateId StateId, state *State, result *schema.CheckResult)
Click to show internal directories.
Click to hide internal directories.