push

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	ExitSignal chan os.Signal
	// contains filtered or unexported fields
}

API implements the rest interface every check has to expose.

func (*API) Run

func (p *API) Run()

Run Starts the goroutine that listens for SIGTERM signal.

func (*API) Shutdown

func (p *API) Shutdown() error

Shutdown stops the goroutine that listens for SIGTERM signal.

type APICheck

type APICheck interface {
	Abort() error
}

APICheck represents the checker the push api communicates with. This is usefull to write unit tests because makes mocking dependencies of this component easier.

type Check

type Check struct {
	Logger *log.Entry
	Name   string
	// contains filtered or unexported fields
}

Check stores the 'pieces' needed to run a checker.

func NewCheckWithConfig

func NewCheckWithConfig(name string, checker Checker, logger *log.Entry, conf *config.Config) *Check

NewCheckWithConfig creates a check with a given configuration

func (*Check) Abort

func (c *Check) Abort() (err error)

Abort recives the Abort message from the api that is listening for a term signal.

func (*Check) RunAndServe

func (c *Check) RunAndServe()

RunAndServe start running the check.

func (*Check) Shutdown

func (c *Check) Shutdown() error

Shutdown causes the Check to shutdown the API and the State provider. Also as a side effect, RunAndServe will also return.

type Checker

type Checker interface {
	Run(ctx context.Context, target, assetType string, opts string, state state.State) error
	CleanUp(ctx context.Context, target, assetType, opts string)
}

Checker defines the shape a checker must have in order to be executed as vulcan-check.

type State

type State struct {
	// contains filtered or unexported fields
}

State implements a state that uses a pusher to send state changes to an agent. This implementation is NOT SYNCHRONIZED, that is not not suitable to be be used by multiple goroutines

func (*State) SetEndTime

func (p *State) SetEndTime(t time.Time)

SetEndTime sets the time when the check has finished. This method does not send notification to the agent.

func (*State) SetProgress

func (p *State) SetProgress(progress float32)

SetProgress sets the progress of the current state, but only if the status is agent.StatusRunning and progress has increased. This method sends a notification to the agent.

func (*State) SetStartTime

func (p *State) SetStartTime(t time.Time)

SetStartTime sets the time when the check started. This method does not send notification to the agent.

func (*State) SetStatusAborted

func (p *State) SetStatusAborted()

SetStatusAborted sets the state of the current check to Running and the progress to 1.0. This method sends a notification to the agent.

func (*State) SetStatusFailed

func (p *State) SetStatusFailed(err error)

SetStatusFailed sets the state of the current check to Running and the progress to 1.0 This method sends a notification to the agent.

func (*State) SetStatusFinished

func (p *State) SetStatusFinished()

SetStatusFinished sets the state of the current check to Running and the progress to 1.0. This method sends a notification to the agent.

func (*State) SetStatusInconclusive

func (p *State) SetStatusInconclusive()

SetStatusInconclusive sets the state of the current check to Inconclusive and the progress to 1.0 This method sends a notification to the agent.

func (*State) SetStatusRunning

func (p *State) SetStatusRunning()

SetStatusRunning sets the state of the current check to Running and the progress to 1.0.

func (*State) Shutdown

func (p *State) Shutdown() error

Shutdown the state gracefully.

func (*State) State

func (p *State) State() (state *agent.State)

State returns current state.

type StatePusher

type StatePusher interface {
	UpdateState(state interface{})
	Shutdown() error
}

StatePusher defines the shape a pusher communications component must satisfy in order to be used by the PushState. This is usefull to write unit tests because makes mocking dependencies of this component easier.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL