clusterutil

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrTopologyReadFailed is ErrTopologyReadFailed
	ErrTopologyReadFailed = errNSTopolohy.NewType("read_failed", errutil.ErrTraitPreCheck)
	// ErrTopologyParseFailed is ErrTopologyParseFailed
	ErrTopologyParseFailed = errNSTopolohy.NewType("parse_failed", errutil.ErrTraitPreCheck)
)
View Source
var (
	// ErrInvalidClusterName is an error for invalid cluster name. You should use `ValidateClusterNameOrError()`
	// to generate this error.
	ErrInvalidClusterName = errorx.CommonErrors.NewType("invalid_cluster_name", errutil.ErrTraitPreCheck)
)

Functions

func Abs

func Abs(user, path string) string

Abs returns the absolute path

func IsTimeoutOrMaxRetry

func IsTimeoutOrMaxRetry(err error) bool

IsTimeoutOrMaxRetry return true if it's timeout or reach max retry.

func JoinInt

func JoinInt(nums []int, delim string) string

JoinInt joins a slice of int to string

func MultiDirAbs

func MultiDirAbs(user, paths string) []string

MultiDirAbs returns the absolute path for multi-dir separated by comma

func ParseTopologyYaml

func ParseTopologyYaml(file string, out interface{}) error

ParseTopologyYaml read yaml content from `file` and unmarshal it to `out`

func Retry

func Retry(doFunc func() error, opts ...RetryOption) error

Retry retries the func until it returns no error or reaches attempts limit or timed out, either one is earlier

func ValidateClusterNameOrError

func ValidateClusterNameOrError(n string) error

ValidateClusterNameOrError validates a cluster name and returns error if the name is invalid.

Types

type Repository

type Repository interface {
	DownloadComponent(comp, version, target string) error
	VerifyComponent(comp, version, target string) error
	ComponentBinEntry(comp, version string) (string, error)
}

Repository exports interface to tiup-cluster

func NewRepository

func NewRepository(os, arch string) (Repository, error)

NewRepository returns repository

type RetryOption

type RetryOption struct {
	Attempts int64
	Delay    time.Duration
	Timeout  time.Duration
}

RetryOption is options for Retry()

Jump to

Keyboard shortcuts

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