backup

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupCleaner

type BackupCleaner interface {
	Clean(ctx context.Context, backup *v1alpha1.Backup) error
}

BackupCleaner implements the logic for cleaning backup

func NewBackupCleaner

func NewBackupCleaner(cli client.Client, statusUpdater BackupConditionUpdaterInterface, backupManagerImage string) BackupCleaner

NewBackupCleaner returns a BackupCleaner

type BackupConditionUpdaterInterface

type BackupConditionUpdaterInterface interface {
	Update(ctx context.Context, backup *v1alpha1.Backup, condition *v1alpha1.BackupCondition, newStatus *BackupUpdateStatus) error
}

BackupConditionUpdaterInterface enables updating Backup conditions.

func NewRealBackupConditionUpdater

func NewRealBackupConditionUpdater(
	cli client.Client,
	recorder record.EventRecorder,
) BackupConditionUpdaterInterface

NewRealBackupConditionUpdater returns a BackupConditionUpdaterInterface that updates the Status of a Backup,

type BackupManager

type BackupManager interface {
	// Sync	implements the logic for syncing Backup.
	Sync(ctx context.Context, backup *v1alpha1.Backup) error
	// UpdateStatus updates the status for a Backup, include condition and status info.
	UpdateStatus(ctx context.Context, backup *v1alpha1.Backup, condition *v1alpha1.BackupCondition, newStatus *BackupUpdateStatus) error
}

BackupManager implements the logic for manage backup.

func NewBackupManager

func NewBackupManager(
	cli client.Client,
	pdcm pdm.PDClientManager,
	statusUpdater BackupConditionUpdaterInterface,
	backupManagerImage string,
) BackupManager

NewBackupManager return backupManager

type BackupTracker

type BackupTracker interface {
	StartTrackLogBackupProgress(ctx context.Context, backup *v1alpha1.Backup) error
}

BackupTracker implements the logic for tracking log backup progress

func NewBackupTracker

func NewBackupTracker(cli client.Client, pdcm pdm.PDClientManager, statusUpdater BackupConditionUpdaterInterface) BackupTracker

NewBackupTracker returns a BackupTracker

type BackupUpdateStatus

type BackupUpdateStatus struct {
	// BackupPath is the location of the backup.
	BackupPath *string
	// TimeStarted is the time at which the backup was started.
	TimeStarted *metav1.Time
	// TimeCompleted is the time at which the backup was completed.
	TimeCompleted *metav1.Time
	// BackupSizeReadable is the data size of the backup.
	// the difference with BackupSize is that its format is human readable
	BackupSizeReadable *string
	// BackupSize is the data size of the backup.
	BackupSize *int64
	// CommitTs is the snapshot time point of tidb cluster.
	CommitTs *string
	// LogCheckpointTs is the ts of log backup process.
	LogCheckpointTs *string
	// LogSuccessTruncateUntil is log backup already successfully truncate until timestamp.
	LogSuccessTruncateUntil *string
	// LogTruncatingUntil is log backup truncate until timestamp which is used to mark the truncate command.
	LogTruncatingUntil *string
	// ProgressStep the step name of progress.
	ProgressStep *string
	// Progress is the step's progress value.
	Progress *int
	// ProgressUpdateTime is the progress update time.
	ProgressUpdateTime *metav1.Time

	// RetryNum is the number of retry
	RetryNum *int
	// DetectFailedAt is the time when detect failure
	DetectFailedAt *metav1.Time
	// ExpectedRetryAt is the time we calculate and expect retry after it
	ExpectedRetryAt *metav1.Time
	// RealRetryAt is the time when the retry was actually initiated
	RealRetryAt *metav1.Time
	// Reason is the reason of retry
	RetryReason *string
	// OriginalReason is the original reason of backup job or pod failed
	OriginalReason *string
}

BackupUpdateStatus represents the status of a backup to be updated. This structure should keep synced with the fields in `BackupStatus` except for `Phase` and `Conditions`.

type FakeBackupManager

type FakeBackupManager struct {
	// contains filtered or unexported fields
}

func NewFakeBackupManager

func NewFakeBackupManager() *FakeBackupManager

func (*FakeBackupManager) SetSyncError

func (m *FakeBackupManager) SetSyncError(err error)

func (*FakeBackupManager) Sync

func (*FakeBackupManager) UpdateStatus

UpdateStatus updates the status for a Backup, include condition and status info.

Jump to

Keyboard shortcuts

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