Documentation ¶
Index ¶
- Variables
- func ConstructBRGlobalOptionsForBackup(backup *v1alpha1.Backup) ([]string, error)
- func ConstructBRGlobalOptionsForRestore(restore *v1alpha1.Restore) ([]string, error)
- func ConstructDumplingOptionsForBackup(backup *v1alpha1.Backup) []string
- func ConstructRcloneArgs(conf string, opts []string, command, source, dest string, verboseLog bool) []string
- func EnsureDirectoryExist(dirName string) error
- func GetBRArchiveSize(meta *kvbackup.BackupMeta) uint64
- func GetBRMetaData(ctx context.Context, provider v1alpha1.StorageProvider) (*kvbackup.BackupMeta, error)
- func GetCommitTsFromBRMetaData(ctx context.Context, provider v1alpha1.StorageProvider) (uint64, error)
- func GetCommitTsFromMetadata(backupPath string) (string, error)
- func GetContextForTerminationSignals(op string) (context.Context, context.CancelFunc)
- func GetOptionValueFromEnv(option, envPrefix string) string
- func GetOptions(provider v1alpha1.StorageProvider) []string
- func GetStoragePath(backup *v1alpha1.Backup) (string, error)
- func IsDirExist(path string) bool
- func IsFileExist(file string) bool
- func NewCRCli(kubeconfig string) (versioned.Interface, error)
- func NewEventRecorder(kubeCli kubernetes.Interface, source string) record.EventRecorder
- func NewKubeAndCRCli(kubeconfig string) (kubernetes.Interface, versioned.Interface, error)
- func NewKubeCli(kubeconfig string) (kubernetes.Interface, error)
- func NewStorageBackend(provider v1alpha1.StorageProvider) (*blob.Bucket, error)
- func NormalizeBucketURI(bucket string) string
- func OpenDB(ctx context.Context, dsn string) (*sql.DB, error)
- func Suffix(version string) string
- func ValidCmdFlags(cmdPath string, flagSet *pflag.FlagSet)
- type GenericOptions
- func (bo *GenericOptions) GetDSN(enabledTLSClient bool) (string, error)
- func (bo *GenericOptions) GetTikvGCLifeTime(ctx context.Context, db *sql.DB) (string, error)
- func (bo *GenericOptions) SetTikvGCLifeTime(ctx context.Context, db *sql.DB, gcTime string) error
- func (bo *GenericOptions) String() string
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultVersion is the default tikv and br version
DefaultVersion = "4.0"
)
Functions ¶
func ConstructBRGlobalOptionsForBackup ¶
ConstructBRGlobalOptionsForBackup constructs BR global options for backup and also return the remote path.
func ConstructBRGlobalOptionsForRestore ¶
ConstructBRGlobalOptionsForRestore constructs BR global options for restore.
func ConstructDumplingOptionsForBackup ¶ added in v1.1.3
ConstructDumplingOptionsForBackup constructs dumpling options for backup
func ConstructRcloneArgs ¶ added in v1.1.8
func ConstructRcloneArgs(conf string, opts []string, command, source, dest string, verboseLog bool) []string
ConstructRcloneArgs constructs the rclone args
func EnsureDirectoryExist ¶
EnsureDirectoryExist create directory if does not exist
func GetBRArchiveSize ¶ added in v1.1.7
func GetBRArchiveSize(meta *kvbackup.BackupMeta) uint64
GetBRArchiveSize returns the total size of the backup archive.
func GetBRMetaData ¶ added in v1.1.7
func GetBRMetaData(ctx context.Context, provider v1alpha1.StorageProvider) (*kvbackup.BackupMeta, error)
GetBRMetaData get backup metadata from cloud storage
func GetCommitTsFromBRMetaData ¶ added in v1.1.3
func GetCommitTsFromBRMetaData(ctx context.Context, provider v1alpha1.StorageProvider) (uint64, error)
GetCommitTsFromBRMetaData get backup position from `EndVersion` in BR backup meta
func GetCommitTsFromMetadata ¶ added in v1.1.3
GetCommitTsFromMetadata get commitTs from mydumper's metadata file
metadata file format is as follows:
Started dump at: 2019-06-13 10:00:04 SHOW MASTER STATUS: Log: tidb-binlog Pos: 409054741514944513 GTID: Finished dump at: 2019-06-13 10:00:04
func GetContextForTerminationSignals ¶ added in v1.1.10
func GetContextForTerminationSignals(op string) (context.Context, context.CancelFunc)
GetContextForTerminationSignals get a context for some termination signals, and the context will become done after any of these signals triggered.
func GetOptionValueFromEnv ¶
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 GetStoragePath ¶ added in v1.1.8
GetStoragePath generate the path of a specific storage
func IsDirExist ¶
IsDirExist return true if path exist and is a dir, other cases return false
func IsFileExist ¶
IsFileExist return true if file exist and is a regular file, other cases return false
func NewEventRecorder ¶
func NewEventRecorder(kubeCli kubernetes.Interface, source string) record.EventRecorder
NewEventRecorder return the specify source's recoder
func NewKubeAndCRCli ¶
NewKubeAndCRCli create both kube cli and CR cli
func NewKubeCli ¶
func NewKubeCli(kubeconfig string) (kubernetes.Interface, error)
NewKubeCli create a kubeCli Interface
func NewStorageBackend ¶ added in v1.1.8
func NewStorageBackend(provider v1alpha1.StorageProvider) (*blob.Bucket, error)
NewStorageBackend creates new storage backend, now supports S3/GCS/Local
func NormalizeBucketURI ¶
NormalizeBucketURI normal bucket URL for rclone, e.g. s3://bucket -> s3:bucket
func ValidCmdFlags ¶
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 (*GenericOptions) SetTikvGCLifeTime ¶
func (*GenericOptions) String ¶
func (bo *GenericOptions) String() string