Documentation ¶
Index ¶
- func InstallArchive(ctx context.Context, node string, rawURL string, dest string) error
- func IsDaemonRunning(ctx context.Context, node string, cmd string, pidFile string) bool
- func IsDir(ctx context.Context, node string, path string) bool
- func IsFileExist(ctx context.Context, node string, name string) bool
- func IsProcessExist(ctx context.Context, node string, pid int) bool
- func KillDaemon(ctx context.Context, node string, cmd string, pidFile string) error
- func Mkdir(ctx context.Context, node string, dir string) error
- func ReadDir(ctx context.Context, node string, dir string) ([]string, error)
- func RemoveDir(ctx context.Context, node string, dir string) error
- func StartDaemon(ctx context.Context, node string, opts DaemonOptions, cmd string, ...) error
- func StopDaemon(ctx context.Context, node string, cmd string, pidFile string) error
- func Wget(ctx context.Context, node string, rawURL string, dest string) (string, error)
- func WriteFile(ctx context.Context, node string, file string, data string) error
- type BlockRunner
- type DaemonOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallArchive ¶
InstallArchive runs on node, downloads the URL and extracts the archive to the dest diretory. Supports zip, and tarball.
func IsDaemonRunning ¶
IsDaemonRunning runs on node and returns whether the daemon is still running or not.
func IsFileExist ¶
IsFileExist runs on node and returns true if the file exists.
func IsProcessExist ¶
IsProcessExist runs on node and returns true if the porcess still exists.
func KillDaemon ¶
KillDaemon runs on node and kills the daemon process.
func StartDaemon ¶
func StartDaemon(ctx context.Context, node string, opts DaemonOptions, cmd string, cmdArgs ...string) error
StartDaemon runs on node and starts a daemon process with options
func StopDaemon ¶
StopDaemon runs on node and stops the daemon process.
Types ¶
type BlockRunner ¶
type BlockRunner struct {
// contains filtered or unexported fields
}
BlockRunner provides a simple way to run tasks, block until all the tasks are finished.
func (*BlockRunner) Init ¶
func (r *BlockRunner) Init(n int)
Init initializes how many tasks we want to run synchronously.
func (*BlockRunner) Run ¶
func (r *BlockRunner) Run(f func())
Run runs the task in different goroutines and block until all the tasks are finished.
type DaemonOptions ¶
DaemonOptions is the options to start a command in daemon mode.
func NewDaemonOptions ¶
func NewDaemonOptions(chDir string, pidFile string) DaemonOptions
NewDaemonOptions returns a default daemon options.