fstaid

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfig = "fstaid.toml"
)

Variables

This section is empty.

Functions

func ServerShutdown

func ServerShutdown()

Types

type CheckResult

type CheckResult struct {
	Primary       *CommandResult
	Secondary     *CommandResult
	Self          *CommandResult
	SecondarySelf *CommandResult
}

func (*CheckResult) SecondarySelfCheckIsSuccess added in v0.1.5

func (result *CheckResult) SecondarySelfCheckIsSuccess() bool

func (*CheckResult) SelfCheckIsSuccess

func (result *CheckResult) SelfCheckIsSuccess() bool

type Checker

type Checker struct {
	Config    *Config
	Commands  *Commands
	Handler   *Command
	Out       io.Writer
	Running   bool
	WaitGroup *sync.WaitGroup
}

func NewChecker

func NewChecker(config *Config, cmds *Commands, handler *Command) (checker *Checker, err error)

func (*Checker) Check

func (checker *Checker) Check()

func (*Checker) CheckLockFile

func (checker *Checker) CheckLockFile()

func (*Checker) HandleFailure added in v0.1.2

func (checker *Checker) HandleFailure(result *CheckResult)

func (*Checker) HandleFailureWithoutShutdown added in v0.1.2

func (checker *Checker) HandleFailureWithoutShutdown(result *CheckResult)

func (*Checker) Mainloop

func (checker *Checker) Mainloop()

func (*Checker) Run

func (checker *Checker) Run()

func (*Checker) Stop

func (checker *Checker) Stop()

func (*Checker) TouchLockFile

func (checker *Checker) TouchLockFile()

type Command

type Command struct {
	Name    string
	CmdArgs []string
	Timeout time.Duration
}

func NewCommand

func NewCommand(name string, config *CommandConfig) (cmd *Command, err error)

func (*Command) Run

func (command *Command) Run(args ...string) (exitCode int, timeout bool)

type CommandConfig

type CommandConfig struct {
	Command string
	Timeout int
}

type CommandResult

type CommandResult struct {
	ExitCode int
	Timeout  bool
}

func (*CommandResult) IsSuccess

func (result *CommandResult) IsSuccess() bool

type Commands

type Commands struct {
	Config    *Config
	Primary   *Command
	Secondary *Command
	Self      *Command
}

func NewCommands

func NewCommands(config *Config) (cmds *Commands, err error)

func (*Commands) Check

func (cmds *Commands) Check() (result *CheckResult)

func (*Commands) InitCheck added in v0.1.1

func (cmds *Commands) InitCheck() (result *CheckResult)

type Config

type Config struct {
	Global    GlobalConfig
	Primary   CommandConfig
	Secondary CommandConfig
	Self      CommandConfig
	Handler   CommandConfig
	User      []UserConfig
}

func LoadConfig

func LoadConfig(flags *Flags) (config *Config, err error)

type Flags

type Flags struct {
	Config string
}

func ParseFlag

func ParseFlag() (flags *Flags)

type GlobalConfig

type GlobalConfig struct {
	Port                      int
	Maxattempts               int
	AttemptInterval           float64 `toml:"attempt_interval"`
	Interval                  int
	Lockdir                   string
	Log                       string
	Mode                      string
	ContinueIfSelfCheckFailed bool `toml:"continue_if_self_check_failed"`
}

func (*GlobalConfig) LockFile

func (config *GlobalConfig) LockFile() string

type Server

type Server struct {
	Config  *Config
	Engine  *gin.Engine
	Router  gin.IRouter
	Checker *Checker
}

func NewServer

func NewServer(config *Config, checker *Checker, out io.Writer) (server *Server)

func (*Server) Fail

func (server *Server) Fail(c *gin.Context)

func (*Server) Ping

func (server *Server) Ping(c *gin.Context)

func (*Server) Run

func (server *Server) Run()

type UserConfig

type UserConfig struct {
	Userid   string
	Password string
}

Jump to

Keyboard shortcuts

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