Documentation ¶
Index ¶
Constants ¶
const ( StatusCreated = "CREATED" StatusQueued = "QUEUED" StatusAssigned = "ASSIGNED" StatusRunning = "RUNNING" StatusTimeout = "TIMEOUT" StatusAborted = "ABORTED" StatusPurging = "PURGING" StatusKilled = "KILLED" StatusFailed = "FAILED" StatusFinished = "FINISHED" StatusMalformed = "MALFORMED" StatusInconclusive = "INCONCLUSIVE" )
Variables ¶
var TerminalStatuses = map[string]struct{}{ StatusFailed: {}, StatusFinished: {}, StatusInconclusive: {}, StatusKilled: {}, StatusMalformed: {}, StatusTimeout: {}, }
TerminalStatuses contains all the possible statuses of a check that are terminal.
Functions ¶
This section is empty.
Types ¶
type CheckState ¶
type CheckState struct { ID string `json:"id" validate:"required"` Status *string `json:"status,omitempty"` AgentID *string `json:"agent_id,omitempty"` Report *string `json:"report,omitempty"` Raw *string `json:"raw,omitempty"` Progress *float32 `json:"progress,omitempty"` }
CheckState defines the all the possible fields of the states sent to the check state queue.
func (*CheckState) Merge ¶ added in v1.1.2
func (cs *CheckState) Merge(s CheckState)
Merge overrides the fields of the receiver with the value of the non nil fields of the provided CheckState.
type QueueWriter ¶
QueueWriter defines the queue services used by and updater to send the status updates.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater takes a CheckState an send its to a queue using the defined queue writer.
func New ¶
func New(qw QueueWriter) *Updater
New creates a new updater using the provided queue writer.
func (*Updater) CheckStatusTerminal ¶
CheckStatusTerminal returns true if a check with the given ID has sent so far a state update including a status in a terminal state.
func (*Updater) FlushCheckStatus ¶ added in v1.1.1
FlushCheckStatus deletes the information about a check that the Updater is storing. Before deleting the check from the "list" of finished checks, it writes the state of the check to the queue.
func (*Updater) UpdateCheckStatusTerminal ¶ added in v1.1.1
func (u *Updater) UpdateCheckStatusTerminal(s CheckState)
UpdateCheckStatusTerminal update and keep the information about a check in a status terminal.
func (*Updater) UpdateState ¶
func (u *Updater) UpdateState(s CheckState) error
UpdateState updates the state of tha check into the underlying queue. If the state is terminal it keeps the state in memory locally. If the state is not terminal it sends the state to queue.