util

package
v1.1.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultVersion is the default tikv and br version
	DefaultVersion = "4.0"
)

Functions

func ConstructArgs

func ConstructArgs(conf string, opts []string, command, source, dest string) []string

ConstructArgs constructs the rclone args

func ConstructBRGlobalOptionsForBackup

func ConstructBRGlobalOptionsForBackup(backup *v1alpha1.Backup) ([]string, string, error)

ConstructBRGlobalOptionsForBackup constructs BR global options for backup and also return the remote path.

func ConstructBRGlobalOptionsForRestore

func ConstructBRGlobalOptionsForRestore(restore *v1alpha1.Restore) ([]string, error)

ConstructBRGlobalOptionsForRestore constructs BR global options for restore.

func ConstructMydumperOptionsForBackup

func ConstructMydumperOptionsForBackup(backup *v1alpha1.Backup) []string

ConstructMydumperOptionsForBackup constructs mydumper options for backup

func EnsureDirectoryExist

func EnsureDirectoryExist(dirName string) error

EnsureDirectoryExist create directory if does not exist

func GetOptionValueFromEnv

func GetOptionValueFromEnv(option, envPrefix string) string

GetOptionValueFromEnv get option's value from environment variable. If unset, return empty string.

func GetOptions

func GetOptions(provider v1alpha1.StorageProvider) []string

GetOptions gets the rclone options

func IsDirExist

func IsDirExist(path string) bool

IsDirExist return true if path exist and is a dir, other cases return false

func IsFileExist

func IsFileExist(file string) bool

IsFileExist return true if file exist and is a regular file, other cases return false

func NewCRCli

func NewCRCli(kubeconfig string) (versioned.Interface, error)

NewCRCli create a CR cli Interface

func NewEventRecorder

func NewEventRecorder(kubeCli kubernetes.Interface, source string) record.EventRecorder

NewEventRecorder return the specify source's recoder

func NewKubeAndCRCli

func NewKubeAndCRCli(kubeconfig string) (kubernetes.Interface, versioned.Interface, error)

NewKubeAndCRCli create both kube cli and CR cli

func NewKubeCli

func NewKubeCli(kubeconfig string) (kubernetes.Interface, error)

NewKubeCli create a kubeCli Interface

func NewRemoteStorage

func NewRemoteStorage(backup *v1alpha1.Backup) (*blob.Bucket, error)

NewRemoteStorage creates new remote storage

func NormalizeBucketURI

func NormalizeBucketURI(bucket string) string

NormalizeBucketURI normal bucket URL for rclone, e.g. s3://bucket -> s3:bucket

func OpenDB

func OpenDB(dsn string) (*sql.DB, error)

OpenDB opens db

func Suffix

func Suffix(version string) string

Suffix parses the major and minor version from the string and return the suffix

func ValidCmdFlags

func ValidCmdFlags(cmdPath string, flagSet *pflag.FlagSet)

ValidCmdFlags verify that all flags are set

Types

type GenericOptions

type GenericOptions struct {
	Namespace string
	// ResourceName can be the name of a backup or restore resource
	ResourceName string
	TLSClient    bool
	TLSCluster   bool
	Host         string
	Port         int32
	Password     string
	User         string
	TiKVVersion  string
}

GenericOptions contains the generic input arguments to the backup/restore command

func (*GenericOptions) GetDSN

func (bo *GenericOptions) GetDSN(enabledTLSClient bool) (string, error)

func (*GenericOptions) GetTikvGCLifeTime

func (bo *GenericOptions) GetTikvGCLifeTime(db *sql.DB) (string, error)

func (*GenericOptions) SetTikvGCLifeTime

func (bo *GenericOptions) SetTikvGCLifeTime(db *sql.DB, gcTime string) error

func (*GenericOptions) String

func (bo *GenericOptions) String() string

Jump to

Keyboard shortcuts

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