Documentation ¶
Index ¶
- Constants
- func InitLogger(logger *zap.SugaredLogger, level zap.AtomicLevel)
- type Alert
- type Alerts
- type Checks
- type Command
- func (c *Command) CleanTempFile()
- func (c Command) GetCommands() string
- func (c *Command) Run(conns Connections, args InstanceArguments) (err error)
- func (c *Command) RunOsCommand(args InstanceArguments) (err error)
- func (c Command) ScriptBody() (scriptBody string)
- func (c *Command) ScriptFile() (scriptFile string)
- func (c Command) Verify(stepName string, conns Connections) (errs []error)
- func (c Command) VerifyScriptFile() (err error)
- type Commands
- func (cs Commands) Clone() (clone Commands)
- func (cs Commands) Rc() (rc int)
- func (cs *Commands) Run(conns Connections, args InstanceArguments) (err error)
- func (cs Commands) StdErr() (stdErr Result)
- func (cs Commands) StdOut() (stdOut Result)
- func (cs Commands) Verify(stepName string, conns Connections) (errs []error)
- type Config
- type Connections
- type Handler
- type Instance
- type InstanceArguments
- type Instances
- type Log
- type Logs
- type MatrixArgValues
- type MatrixArgs
- type Result
- type ResultLine
- type Runner
- type Runners
- type Step
- func (s Step) Clone() *Step
- func (s *Step) Done() bool
- func (s Step) GetInstances() Instances
- func (s *Step) Initialize()
- func (s *Step) InstanceFinished(instance string) bool
- func (s Step) Rc() int
- func (s Step) Ready() bool
- func (s *Step) SetInstances()
- func (s Step) StdErr() Result
- func (s Step) StdOut() Result
- func (s Step) Waiting() bool
- type Steps
- func (ss Steps) CheckWhen(all Handler, stepName string) (bool, error)
- func (ss Steps) Clone() Steps
- func (ss Steps) GetNumInstances() int
- func (ss Steps) GetReadySteps() (ready []string)
- func (ss *Steps) Initialize()
- func (ss *Steps) InstanceFinished(w Work)
- func (ss Steps) NumWaiting() (numWaiting int)
- func (ss Steps) Verify(conns Connections) (errs []error)
- type Target
- type Work
Constants ¶
const MatrixInstancePrefix = "PGQ_INSTANCE"
Variables ¶
This section is empty.
Functions ¶
func InitLogger ¶
func InitLogger(logger *zap.SugaredLogger, level zap.AtomicLevel)
Types ¶
type Command ¶
type Command struct { Name string `yaml:"name"` Type string `yaml:"type"` Inline string `yaml:"inline,omitempty"` // Home (~) is not resolved File string `yaml:"file,omitempty"` Rc int `yaml:"-"` Test string `yaml:"test,omitempty"` Matrix map[string]string `yaml:"matrix,omitempty"` // contains filtered or unexported fields }
func (*Command) CleanTempFile ¶
func (c *Command) CleanTempFile()
func (Command) GetCommands ¶
func (*Command) Run ¶
func (c *Command) Run(conns Connections, args InstanceArguments) (err error)
func (*Command) RunOsCommand ¶
func (c *Command) RunOsCommand(args InstanceArguments) (err error)
func (Command) ScriptBody ¶
ScriptBody does the exact opposite of ScriptFile. For Command.File it reads the contents. In other situations it just returns Command.Inline. This is wat is used to run commands on database connections.
func (*Command) ScriptFile ¶
ScriptFile returns a path to the script holding the command. This could be the symlink evaluated version of Command.File. Or this could be an executable temporary file with Command.Inline as contents. This is wat is used to run shell commands
func (Command) VerifyScriptFile ¶
type Commands ¶
type Commands []*Command
func (*Commands) Run ¶
func (cs *Commands) Run(conns Connections, args InstanceArguments) (err error)
type Config ¶
type Config struct { Steps Steps `yaml:"steps"` Checks Commands `yaml:"checks"` Target Target `yaml:"target"` Conns Connections `yaml:"connections"` Alert []Alert `yaml:"alerts"` Log []Log `yaml:"log"` Debug bool `yaml:"debug"` Parallel int `yaml:"parallel"` Workdir string `yaml:"workdir"` EtcdConfig etcd.Config `yaml:"etcdConfig"` Timeout string `yaml:"timeout"` }
func (Config) GetTimeoutContext ¶
func (*Config) Initialize ¶
func (c *Config) Initialize()
type Connections ¶
func (Connections) Execute ¶
func (cs Connections) Execute(connName string, query string, args InstanceArguments) (result Result, err error)
type Handler ¶
func NewHandler ¶
func (*Handler) VerifyConfig ¶
func (h *Handler) VerifyConfig()
func (Handler) VerifyRoles ¶
type Instance ¶ added in v0.1.3
type Instance struct {
// contains filtered or unexported fields
}
func NewInstance ¶ added in v0.1.3
func NewInstance(args InstanceArguments, commands Commands) *Instance
type InstanceArguments ¶
InstanceArguments are key=value pairs which is extrapolated from MatrixArgs One InstanceArguments is parsed to a step instance
func (InstanceArguments) AsEnv ¶
func (ias InstanceArguments) AsEnv() []string
func (InstanceArguments) Clone ¶
func (ias InstanceArguments) Clone() (newMia InstanceArguments)
func (InstanceArguments) ParseQuery ¶
func (ias InstanceArguments) ParseQuery(query string) (parsedQuery string, args []interface{})
ParseQuery can take a query with named arguments and convert it into a query with numbered arguments. Inspired by https://github.com/jackc/pgx/issues/387#issuecomment-798348824
func (InstanceArguments) String ¶
func (ias InstanceArguments) String() string
type MatrixArgValues ¶
type MatrixArgValues []string
MatrixArgValues is an array for all the values that one MatrixArg could have
func (MatrixArgValues) Explode ¶
func (mavs MatrixArgValues) Explode(key string, collected []InstanceArguments) (exploded []InstanceArguments)
type MatrixArgs ¶
type MatrixArgs map[string]MatrixArgValues
MatrixArgs is a map of Matrix Arguments. The keys are the names of the argument and - will be prefixed and uppercased when set for shell commands - will be changed into numbered args when set for sql commands
func (MatrixArgs) Instances ¶
func (mas MatrixArgs) Instances() (ias []InstanceArguments)
type Result ¶
type Result []ResultLine
func NewResultFromString ¶
func (Result) ContainsLine ¶
func (Result) RegExpContains ¶
type ResultLine ¶
type ResultLine string
func (ResultLine) Contains ¶
func (r ResultLine) Contains(part string) bool
type Step ¶
type Step struct { Commands Commands `yaml:"commands"` Depends []string `yaml:"depends,omitempty"` When []string `yaml:"when,omitempty"` Matrix MatrixArgs `yaml:"matrix,omitempty"` Instances Instances `yaml:"-"` // contains filtered or unexported fields }
func (Step) GetInstances ¶
func (*Step) Initialize ¶ added in v0.1.3
func (s *Step) Initialize()
func (*Step) InstanceFinished ¶
func (*Step) SetInstances ¶
func (s *Step) SetInstances()
type Steps ¶
func (Steps) GetNumInstances ¶
func (Steps) GetReadySteps ¶
func (*Steps) Initialize ¶
func (ss *Steps) Initialize()
func (*Steps) InstanceFinished ¶ added in v0.1.3
func (Steps) NumWaiting ¶
func (Steps) Verify ¶
func (ss Steps) Verify(conns Connections) (errs []error)