service

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package service is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrRestorePrerequisitesFailed = errors.New("restore pre-requisites failed")

Functions

func NewRestoreRunningJob added in v3.6.0

func NewRestoreRunningJob(
	startTime time.Time,
	finishTime *time.Time,
	done, total uint64,
	metrics *models.Metrics,
	jobStatus model.RestoreState,
) *model.RunningJob

NewRestoreRunningJob created new RunningJob for restore with calculated estimated time and percentage.

func NewScheduler

func NewScheduler(ctx context.Context, appLogger *slog.Logger) (quartz.Scheduler, error)

NewScheduler creates a new quartz.Scheduler.

Types

type AdHocScheduler added in v3.6.0

type AdHocScheduler interface {
	// TriggerAdHocFullBackup schedules one full backup run for routineName after delay.
	TriggerAdHocFullBackup(routine *model.BackupRoutine, delay time.Duration) error
	// TriggerAdHocIncrementalBackup schedules one incremental backup run for routineName after delay.
	TriggerAdHocIncrementalBackup(routine *model.BackupRoutine, delay time.Duration) error
}

AdHocScheduler schedules one-off full or incremental backup jobs on demand.

type BackupBackendServiceImpl added in v3.1.0

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

BackupBackendServiceImpl default implementation of BackupReaderWriter.

func NewBackupBackendService added in v3.1.0

func NewBackupBackendService(
	pathService PathService,
	operations storageOperations,
) *BackupBackendServiceImpl

func (*BackupBackendServiceImpl) Delete added in v3.1.0

func (b *BackupBackendServiceImpl) Delete(ctx context.Context, routine *model.BackupRoutine, path string) error

func (*BackupBackendServiceImpl) GetBackups added in v3.1.0

func (*BackupBackendServiceImpl) WriteBackupMetadata added in v3.1.0

func (b *BackupBackendServiceImpl) WriteBackupMetadata(
	ctx context.Context,
	routine *model.BackupRoutine,
	path string,
	metadata model.BackupMetadata,
) error

type BackupCompletionHandler added in v3.5.0

type BackupCompletionHandler interface {
	// OnSuccess is called after a backup completes successfully.
	// For full backups it also runs retention and backs up cluster configuration.
	OnSuccess(
		ctx context.Context,
		routine *model.BackupRoutine,
		backupType model.BackupType,
		timestamp time.Time,
		logger *slog.Logger,
	)
	// OnFailure is called when a backup fails (clears failed state in registry).
	OnFailure(routine *model.BackupRoutine, backupType model.BackupType)
}

BackupCompletionHandler handles registry state and side-effects after backup completes.

func NewBackupCompletionHandler added in v3.5.0

func NewBackupCompletionHandler(
	registry RunningBackupsRegistry,
	retentionManager RetentionManager,
	clusterConfigWriter ClusterConfigWriter,
) BackupCompletionHandler

NewBackupCompletionHandler returns a BackupCompletionHandler that delegates to registry, retentionManager, and clusterConfigWriter.

type BackupFilter added in v3.1.0

type BackupFilter interface {
	// contains filtered or unexported methods
}

BackupFilter is an interface that all filter types must implement.

type BackupNamespacesOperation added in v3.1.0

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

BackupNamespacesOperation aggregates backup operations across multiple namespaces. It creates individual backup process instances for each namespace and waits for their execution. Implements CancelableBackupHandler, so it can be treated as a unified handler externally.

func (*BackupNamespacesOperation) Cancel added in v3.1.0

func (op *BackupNamespacesOperation) Cancel()

Cancel stops all running backup operations.

func (*BackupNamespacesOperation) GetMetrics added in v3.1.0

func (op *BackupNamespacesOperation) GetMetrics() *models.Metrics

GetMetrics sums backup-go metrics across all namespace handlers.

func (*BackupNamespacesOperation) GetStats added in v3.1.0

GetStats returns aggregated statistics across all namespace handlers. Returns nil when no namespace backup has started yet (all inner GetStats are nil).

func (*BackupNamespacesOperation) Wait added in v3.1.0

Wait waits for all backup operations to complete and collects any errors that occurred during the backup process.

type BackupOrchestrator added in v3.6.0

type BackupOrchestrator interface {
	// Backup executes a full or incremental backup for the given routine snapshot.
	Backup(ctx context.Context, routine *model.BackupRoutine, now time.Time, backupType model.BackupType)
}

BackupOrchestrator runs a full or incremental backup for a routine snapshot.

type BackupOrchestratorImpl added in v3.6.0

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

BackupOrchestratorImpl runs backup operations for a routine.

func NewBackupOrchestrator added in v3.6.0

func NewBackupOrchestrator(
	registry RunningBackupsRegistry,
	completionHandler BackupCompletionHandler,
	reporter BackupReporter,
	startController StartController,
	backupRunner RoutineBackupRunner,
) *BackupOrchestratorImpl

NewBackupOrchestrator builds a BackupOrchestratorImpl from shared service dependencies.

func (*BackupOrchestratorImpl) Backup added in v3.6.0

func (p *BackupOrchestratorImpl) Backup(
	ctx context.Context,
	routine *model.BackupRoutine,
	now time.Time,
	backupType model.BackupType,
)

Backup executes a full or incremental backup for the given routine snapshot.

type BackupReader added in v3.1.0

type BackupReader interface {
	// GetBackups retrieves backup details based on the provided filter.
	// Returned backups are sorted by Created time in ascending order.
	GetBackups(ctx context.Context, filter BackupFilter) ([]model.BackupDetails, error)
}

BackupReader defines operations for reading backups metadata.

type BackupReaderWriter added in v3.1.0

type BackupReaderWriter interface {
	BackupReader
	BackupWriter
}

BackupReaderWriter defines operations for reading and writing backups metadata.

type BackupReporter added in v3.6.0

type BackupReporter interface {
	// Report logs the backup outcome and emits the corresponding Prometheus metrics.
	// For successful backups, err should be nil.
	// For skipped backups, err should be the skip reason.
	Report(
		routineName string,
		backupType model.BackupType,
		startTime time.Time,
		duration time.Duration,
		err error,
		logger *slog.Logger,
	)
}

BackupReporter logs backup outcomes and emits Prometheus metrics.

func NewBackupReporter added in v3.6.0

func NewBackupReporter() BackupReporter

NewBackupReporter returns a BackupReporter that logs and emits Prometheus metrics.

type BackupScheduler added in v3.6.0

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

BackupScheduler wires Quartz to the backup orchestrator: periodic cron jobs, ad-hoc runs, and job deletion.

func NewBackupScheduler added in v3.6.0

func NewBackupScheduler(scheduler JobScheduler, orchestrator BackupOrchestrator) *BackupScheduler

NewBackupScheduler creates a scheduler backed by Quartz and a BackupOrchestrator.

func (*BackupScheduler) DeleteJob added in v3.6.0

func (s *BackupScheduler) DeleteJob(key *quartz.JobKey) error

DeleteJob removes a scheduled job (e.g. when clearing periodic jobs on config change).

func (*BackupScheduler) ScheduleRoutines added in v3.6.0

func (s *BackupScheduler) ScheduleRoutines(routines []*model.BackupRoutine) error

ScheduleRoutines registers cron triggers for the given routines (full and optional incremental).

func (*BackupScheduler) TriggerAdHocFullBackup added in v3.6.0

func (s *BackupScheduler) TriggerAdHocFullBackup(routine *model.BackupRoutine, delay time.Duration) error

TriggerAdHocFullBackup schedules a one-off full backup for routineName.

func (*BackupScheduler) TriggerAdHocIncrementalBackup added in v3.6.0

func (s *BackupScheduler) TriggerAdHocIncrementalBackup(routine *model.BackupRoutine, delay time.Duration) error

TriggerAdHocIncrementalBackup schedules a one-off incremental backup for routineName.

type BackupWriter added in v3.1.0

type BackupWriter interface {
	// WriteBackupMetadata stores metadata for a specific backup.
	WriteBackupMetadata(context.Context, *model.BackupRoutine, string, model.BackupMetadata) error

	// Delete removes a specific backup folder.
	Delete(ctx context.Context, routine *model.BackupRoutine, path string) error
}

BackupWriter defines operations for writing backups metadata.

type BaseFilter added in v3.1.0

type BaseFilter struct {
	FromTime *time.Time
	ToTime   *time.Time
}

BaseFilter contains common filter attributes.

type CancelableBackupHandler

type CancelableBackupHandler interface {
	backupexecutor.BackupHandler
	// Cancel requests cancellation of the in-flight backup.
	Cancel()
}

CancelableBackupHandler is a backupexecutor.BackupHandler that can be canceled while a backup is in progress.

type ClusterConfigWriter

type ClusterConfigWriter interface {
	// Write writes the cluster configuration for the given routine and timestamp.
	Write(ctx context.Context, routine *model.BackupRoutine, timestamp time.Time) error
}

ClusterConfigWriter handles writing cluster configuration to storage.

type ConfigApplier

type ConfigApplier interface {
	// ApplyNewConfig applies new configuration to the service.
	ApplyNewConfig(ctx context.Context) error
}

ConfigApplier is responsible for applying new configuration to the service.

func NewDefaultConfigApplier

func NewDefaultConfigApplier(
	backupScheduler *BackupScheduler,
	registry RunningBackupsRegistry,
	config *model.Config,
) ConfigApplier

NewDefaultConfigApplier wires config invalidation to the backup scheduler and running-backups registry.

type ConfigRetriever added in v3.1.0

type ConfigRetriever interface {
	// RetrieveConfiguration returns backed up Aerospike configuration.
	RetrieveConfiguration(context.Context, *model.BackupRoutine, time.Time) ([]byte, error)
}

ConfigRetriever is used to read saved Aerospike configuration from backup.

type ConfigRetrieverImpl added in v3.1.0

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

ConfigRetrieverImpl default implementation of ConfigRetriever.

func NewConfigRetriever added in v3.1.0

func NewConfigRetriever(
	backupReader BackupReaderWriter,
	pathService PathService,
	operations storageFileReader,
) *ConfigRetrieverImpl

func (*ConfigRetrieverImpl) RetrieveConfiguration added in v3.1.0

func (cr *ConfigRetrieverImpl) RetrieveConfiguration(
	ctx context.Context, routine *model.BackupRoutine, toTime time.Time,
) ([]byte, error)

RetrieveConfiguration return backed up Aerospike configuration.

type DefaultClusterConfigWriter

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

DefaultClusterConfigWriter is the default implementation of ClusterConfigWriter.

func NewClusterConfigWriter

func NewClusterConfigWriter(
	clientManager aerospike.ClientManager,
	pathService PathService,
	operations storageDataWriter,
) *DefaultClusterConfigWriter

NewClusterConfigWriter returns a new DefaultClusterConfigWriter instance.

func (*DefaultClusterConfigWriter) Write

func (w *DefaultClusterConfigWriter) Write(
	ctx context.Context,
	routine *model.BackupRoutine,
	timestamp time.Time,
) error

type DefaultConfigApplier

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

DefaultConfigApplier applies configuration changes by unscheduling affected cron jobs, rescheduling from the new config snapshot, and triggering backup-history sync for those routines.

func (*DefaultConfigApplier) ApplyNewConfig added in v3.1.0

func (a *DefaultConfigApplier) ApplyNewConfig(ctx context.Context) error

ApplyNewConfig reschedules periodic jobs and rescans backup history for routines marked invalid in config.

type ErrJobNotFound

type ErrJobNotFound struct {
	JobID model.RestoreJobID
}

func NewErrJobNotFound

func NewErrJobNotFound(id model.RestoreJobID) *ErrJobNotFound

func (*ErrJobNotFound) Error

func (e *ErrJobNotFound) Error() string

type HistoryManager added in v3.5.0

type HistoryManager interface {
	// FindLastRun finds the last backup run for a given routine.
	FindLastRun(ctx context.Context, routine *model.BackupRoutine) (*model.BackupTime, error)
}

type HistoryManagerImpl added in v3.5.0

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

HistoryManagerImpl is a stateless service responsible for scanning storage backends to find the most recent backup timestamps.

func NewHistoryManager added in v3.5.0

func NewHistoryManager(
	backupReader BackupReader,
) *HistoryManagerImpl

NewHistoryManager creates a new HistoryManagerImpl.

func (*HistoryManagerImpl) FindLastRun added in v3.5.0

func (hm *HistoryManagerImpl) FindLastRun(
	ctx context.Context,
	routine *model.BackupRoutine,
) (*model.BackupTime, error)

FindLastRun performs the I/O to find the last backup for a single routine.

type JobScheduler added in v3.6.0

type JobScheduler interface {
	// ScheduleJob registers jobDetail with the provided trigger.
	ScheduleJob(jobDetail *quartz.JobDetail, trigger quartz.Trigger) error
	// DeleteJob removes the job identified by key.
	DeleteJob(key *quartz.JobKey) error
}

JobScheduler is the subset of quartz.Scheduler used for backup job scheduling and removal.

type MockBackupCompletionHandler added in v3.5.0

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

MockBackupCompletionHandler is a mock of BackupCompletionHandler interface.

func NewMockBackupCompletionHandler added in v3.5.0

func NewMockBackupCompletionHandler(ctrl *gomock.Controller) *MockBackupCompletionHandler

NewMockBackupCompletionHandler creates a new mock instance.

func (*MockBackupCompletionHandler) EXPECT added in v3.5.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBackupCompletionHandler) OnFailure added in v3.5.0

func (m *MockBackupCompletionHandler) OnFailure(routine *model.BackupRoutine, backupType model.BackupType)

OnFailure mocks base method.

func (*MockBackupCompletionHandler) OnSuccess added in v3.5.0

func (m *MockBackupCompletionHandler) OnSuccess(ctx context.Context, routine *model.BackupRoutine, backupType model.BackupType, timestamp time.Time, logger *slog.Logger)

OnSuccess mocks base method.

type MockBackupCompletionHandlerMockRecorder added in v3.5.0

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

MockBackupCompletionHandlerMockRecorder is the mock recorder for MockBackupCompletionHandler.

func (*MockBackupCompletionHandlerMockRecorder) OnFailure added in v3.5.0

func (mr *MockBackupCompletionHandlerMockRecorder) OnFailure(routine, backupType any) *gomock.Call

OnFailure indicates an expected call of OnFailure.

func (*MockBackupCompletionHandlerMockRecorder) OnSuccess added in v3.5.0

func (mr *MockBackupCompletionHandlerMockRecorder) OnSuccess(ctx, routine, backupType, timestamp, logger any) *gomock.Call

OnSuccess indicates an expected call of OnSuccess.

type MockBackupReader added in v3.1.0

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

MockBackupReader is a mock of BackupReader interface.

func NewMockBackupReader added in v3.1.0

func NewMockBackupReader(ctrl *gomock.Controller) *MockBackupReader

NewMockBackupReader creates a new mock instance.

func (*MockBackupReader) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBackupReader) GetBackups added in v3.1.0

func (m *MockBackupReader) GetBackups(ctx context.Context, filter BackupFilter) ([]model.BackupDetails, error)

GetBackups mocks base method.

type MockBackupReaderMockRecorder added in v3.1.0

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

MockBackupReaderMockRecorder is the mock recorder for MockBackupReader.

func (*MockBackupReaderMockRecorder) GetBackups added in v3.1.0

func (mr *MockBackupReaderMockRecorder) GetBackups(ctx, filter any) *gomock.Call

GetBackups indicates an expected call of GetBackups.

type MockBackupReaderWriter added in v3.1.0

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

MockBackupReaderWriter is a mock of BackupReaderWriter interface.

func NewMockBackupReaderWriter added in v3.1.0

func NewMockBackupReaderWriter(ctrl *gomock.Controller) *MockBackupReaderWriter

NewMockBackupReaderWriter creates a new mock instance.

func (*MockBackupReaderWriter) Delete added in v3.1.0

func (m *MockBackupReaderWriter) Delete(ctx context.Context, routine *model.BackupRoutine, path string) error

Delete mocks base method.

func (*MockBackupReaderWriter) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBackupReaderWriter) GetBackups added in v3.1.0

GetBackups mocks base method.

func (*MockBackupReaderWriter) WriteBackupMetadata added in v3.1.0

func (m *MockBackupReaderWriter) WriteBackupMetadata(arg0 context.Context, arg1 *model.BackupRoutine, arg2 string, arg3 model.BackupMetadata) error

WriteBackupMetadata mocks base method.

type MockBackupReaderWriterMockRecorder added in v3.1.0

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

MockBackupReaderWriterMockRecorder is the mock recorder for MockBackupReaderWriter.

func (*MockBackupReaderWriterMockRecorder) Delete added in v3.1.0

func (mr *MockBackupReaderWriterMockRecorder) Delete(ctx, routine, path any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockBackupReaderWriterMockRecorder) GetBackups added in v3.1.0

func (mr *MockBackupReaderWriterMockRecorder) GetBackups(ctx, filter any) *gomock.Call

GetBackups indicates an expected call of GetBackups.

func (*MockBackupReaderWriterMockRecorder) WriteBackupMetadata added in v3.1.0

func (mr *MockBackupReaderWriterMockRecorder) WriteBackupMetadata(arg0, arg1, arg2, arg3 any) *gomock.Call

WriteBackupMetadata indicates an expected call of WriteBackupMetadata.

type MockBackupReporter added in v3.6.0

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

MockBackupReporter is a mock of BackupReporter interface.

func NewMockBackupReporter added in v3.6.0

func NewMockBackupReporter(ctrl *gomock.Controller) *MockBackupReporter

NewMockBackupReporter creates a new mock instance.

func (*MockBackupReporter) EXPECT added in v3.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBackupReporter) Report added in v3.6.0

func (m *MockBackupReporter) Report(routineName string, backupType model.BackupType, startTime time.Time, duration time.Duration, err error, logger *slog.Logger)

Report mocks base method.

type MockBackupReporterMockRecorder added in v3.6.0

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

MockBackupReporterMockRecorder is the mock recorder for MockBackupReporter.

func (*MockBackupReporterMockRecorder) Report added in v3.6.0

func (mr *MockBackupReporterMockRecorder) Report(routineName, backupType, startTime, duration, err, logger any) *gomock.Call

Report indicates an expected call of Report.

type MockCancelableBackupHandler added in v3.1.0

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

MockCancelableBackupHandler is a mock of CancelableBackupHandler interface.

func NewMockCancelableBackupHandler added in v3.1.0

func NewMockCancelableBackupHandler(ctrl *gomock.Controller) *MockCancelableBackupHandler

NewMockCancelableBackupHandler creates a new mock instance.

func (*MockCancelableBackupHandler) Cancel added in v3.1.0

func (m *MockCancelableBackupHandler) Cancel()

Cancel mocks base method.

func (*MockCancelableBackupHandler) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCancelableBackupHandler) GetMetrics added in v3.1.0

func (m *MockCancelableBackupHandler) GetMetrics() *models.Metrics

GetMetrics mocks base method.

func (*MockCancelableBackupHandler) GetStats added in v3.1.0

GetStats mocks base method.

func (*MockCancelableBackupHandler) Wait added in v3.1.0

Wait mocks base method.

type MockCancelableBackupHandlerMockRecorder added in v3.1.0

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

MockCancelableBackupHandlerMockRecorder is the mock recorder for MockCancelableBackupHandler.

func (*MockCancelableBackupHandlerMockRecorder) Cancel added in v3.1.0

Cancel indicates an expected call of Cancel.

func (*MockCancelableBackupHandlerMockRecorder) GetMetrics added in v3.1.0

GetMetrics indicates an expected call of GetMetrics.

func (*MockCancelableBackupHandlerMockRecorder) GetStats added in v3.1.0

GetStats indicates an expected call of GetStats.

func (*MockCancelableBackupHandlerMockRecorder) Wait added in v3.1.0

Wait indicates an expected call of Wait.

type MockClusterConfigWriter added in v3.1.0

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

MockClusterConfigWriter is a mock of ClusterConfigWriter interface.

func NewMockClusterConfigWriter added in v3.1.0

func NewMockClusterConfigWriter(ctrl *gomock.Controller) *MockClusterConfigWriter

NewMockClusterConfigWriter creates a new mock instance.

func (*MockClusterConfigWriter) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClusterConfigWriter) Write added in v3.1.0

func (m *MockClusterConfigWriter) Write(ctx context.Context, routine *model.BackupRoutine, timestamp time.Time) error

Write mocks base method.

type MockClusterConfigWriterMockRecorder added in v3.1.0

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

MockClusterConfigWriterMockRecorder is the mock recorder for MockClusterConfigWriter.

func (*MockClusterConfigWriterMockRecorder) Write added in v3.1.0

func (mr *MockClusterConfigWriterMockRecorder) Write(ctx, routine, timestamp any) *gomock.Call

Write indicates an expected call of Write.

type MockHistoryManager added in v3.5.0

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

MockHistoryManager is a mock of HistoryManager interface.

func NewMockHistoryManager added in v3.5.0

func NewMockHistoryManager(ctrl *gomock.Controller) *MockHistoryManager

NewMockHistoryManager creates a new mock instance.

func (*MockHistoryManager) EXPECT added in v3.5.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHistoryManager) FindLastRun added in v3.5.0

func (m *MockHistoryManager) FindLastRun(ctx context.Context, routine *model.BackupRoutine) (*model.BackupTime, error)

FindLastRun mocks base method.

type MockHistoryManagerMockRecorder added in v3.5.0

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

MockHistoryManagerMockRecorder is the mock recorder for MockHistoryManager.

func (*MockHistoryManagerMockRecorder) FindLastRun added in v3.5.0

func (mr *MockHistoryManagerMockRecorder) FindLastRun(ctx, routine any) *gomock.Call

FindLastRun indicates an expected call of FindLastRun.

type MockNamespaceBackupRunner added in v3.6.0

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

MockNamespaceBackupRunner is a mock of NamespaceBackupRunner interface.

func NewMockNamespaceBackupRunner added in v3.6.0

func NewMockNamespaceBackupRunner(ctrl *gomock.Controller) *MockNamespaceBackupRunner

NewMockNamespaceBackupRunner creates a new mock instance.

func (*MockNamespaceBackupRunner) EXPECT added in v3.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockNamespaceBackupRunner) Run added in v3.6.0

Run mocks base method.

type MockNamespaceBackupRunnerMockRecorder added in v3.6.0

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

MockNamespaceBackupRunnerMockRecorder is the mock recorder for MockNamespaceBackupRunner.

func (*MockNamespaceBackupRunnerMockRecorder) Run added in v3.6.0

func (mr *MockNamespaceBackupRunnerMockRecorder) Run(ctx, routine, namespace, runSpec, scanLimiter, logger any) *gomock.Call

Run indicates an expected call of Run.

type MockRestoreManager added in v3.1.0

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

MockRestoreManager is a mock of RestoreManager interface.

func NewMockRestoreManager added in v3.1.0

func NewMockRestoreManager(ctrl *gomock.Controller) *MockRestoreManager

NewMockRestoreManager creates a new mock instance.

func (*MockRestoreManager) CancelRestore added in v3.1.0

func (m *MockRestoreManager) CancelRestore(jobID model.RestoreJobID) error

CancelRestore mocks base method.

func (*MockRestoreManager) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRestoreManager) GetFilteredJobs added in v3.2.0

func (m *MockRestoreManager) GetFilteredJobs(timeBounds model.TimeBounds, statusFilter model.StatusFilter) map[model.RestoreJobID]*model.RestoreJobStatus

GetFilteredJobs mocks base method.

func (*MockRestoreManager) JobStatus added in v3.1.0

JobStatus mocks base method.

func (*MockRestoreManager) Restore added in v3.1.0

Restore mocks base method.

func (*MockRestoreManager) RestoreByTime added in v3.1.0

RestoreByTime mocks base method.

type MockRestoreManagerMockRecorder added in v3.1.0

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

MockRestoreManagerMockRecorder is the mock recorder for MockRestoreManager.

func (*MockRestoreManagerMockRecorder) CancelRestore added in v3.1.0

func (mr *MockRestoreManagerMockRecorder) CancelRestore(jobID any) *gomock.Call

CancelRestore indicates an expected call of CancelRestore.

func (*MockRestoreManagerMockRecorder) GetFilteredJobs added in v3.2.0

func (mr *MockRestoreManagerMockRecorder) GetFilteredJobs(timeBounds, statusFilter any) *gomock.Call

GetFilteredJobs indicates an expected call of GetFilteredJobs.

func (*MockRestoreManagerMockRecorder) JobStatus added in v3.1.0

func (mr *MockRestoreManagerMockRecorder) JobStatus(jobID any) *gomock.Call

JobStatus indicates an expected call of JobStatus.

func (*MockRestoreManagerMockRecorder) Restore added in v3.1.0

func (mr *MockRestoreManagerMockRecorder) Restore(ctx, request any) *gomock.Call

Restore indicates an expected call of Restore.

func (*MockRestoreManagerMockRecorder) RestoreByTime added in v3.1.0

func (mr *MockRestoreManagerMockRecorder) RestoreByTime(ctx, request any) *gomock.Call

RestoreByTime indicates an expected call of RestoreByTime.

type MockRestoreValidator added in v3.5.0

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

MockRestoreValidator is a mock of RestoreValidator interface.

func NewMockRestoreValidator added in v3.5.0

func NewMockRestoreValidator(ctrl *gomock.Controller) *MockRestoreValidator

NewMockRestoreValidator creates a new mock instance.

func (*MockRestoreValidator) EXPECT added in v3.5.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRestoreValidator) ValidatePath added in v3.5.0

func (m *MockRestoreValidator) ValidatePath(ctx context.Context, request *model.RestoreRequest, infoGetter backup.InfoGetter, backups []model.BackupDetails) error

ValidatePath mocks base method.

func (*MockRestoreValidator) ValidateTimestamp added in v3.5.0

func (m *MockRestoreValidator) ValidateTimestamp(ctx context.Context, request *model.RestoreTimestampRequest, infoGetter backup.InfoGetter, backupsByNamespace map[string][]model.BackupDetails) error

ValidateTimestamp mocks base method.

type MockRestoreValidatorMockRecorder added in v3.5.0

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

MockRestoreValidatorMockRecorder is the mock recorder for MockRestoreValidator.

func (*MockRestoreValidatorMockRecorder) ValidatePath added in v3.5.0

func (mr *MockRestoreValidatorMockRecorder) ValidatePath(ctx, request, infoGetter, backups any) *gomock.Call

ValidatePath indicates an expected call of ValidatePath.

func (*MockRestoreValidatorMockRecorder) ValidateTimestamp added in v3.5.0

func (mr *MockRestoreValidatorMockRecorder) ValidateTimestamp(ctx, request, infoGetter, backupsByNamespace any) *gomock.Call

ValidateTimestamp indicates an expected call of ValidateTimestamp.

type MockRetentionManager added in v3.1.0

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

MockRetentionManager is a mock of RetentionManager interface.

func NewMockRetentionManager added in v3.1.0

func NewMockRetentionManager(ctrl *gomock.Controller) *MockRetentionManager

NewMockRetentionManager creates a new mock instance.

func (*MockRetentionManager) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

type MockRetentionManagerMockRecorder added in v3.1.0

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

MockRetentionManagerMockRecorder is the mock recorder for MockRetentionManager.

type MockRoutineBackupRunner added in v3.6.0

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

MockRoutineBackupRunner is a mock of RoutineBackupRunner interface.

func NewMockRoutineBackupRunner added in v3.6.0

func NewMockRoutineBackupRunner(ctrl *gomock.Controller) *MockRoutineBackupRunner

NewMockRoutineBackupRunner creates a new mock instance.

func (*MockRoutineBackupRunner) EXPECT added in v3.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRoutineBackupRunner) Run added in v3.6.0

Run mocks base method.

type MockRoutineBackupRunnerMockRecorder added in v3.6.0

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

MockRoutineBackupRunnerMockRecorder is the mock recorder for MockRoutineBackupRunner.

func (*MockRoutineBackupRunnerMockRecorder) Run added in v3.6.0

func (mr *MockRoutineBackupRunnerMockRecorder) Run(ctx, routine, runSpec, logger any) *gomock.Call

Run indicates an expected call of Run.

type MockRunningBackupsRegistry added in v3.1.0

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

MockRunningBackupsRegistry is a mock of RunningBackupsRegistry interface.

func NewMockRunningBackupsRegistry added in v3.1.0

func NewMockRunningBackupsRegistry(ctrl *gomock.Controller) *MockRunningBackupsRegistry

NewMockRunningBackupsRegistry creates a new mock instance.

func (*MockRunningBackupsRegistry) Cancel added in v3.1.0

func (m *MockRunningBackupsRegistry) Cancel(routineName string)

Cancel mocks base method.

func (*MockRunningBackupsRegistry) EXPECT added in v3.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRunningBackupsRegistry) GetRoutineState added in v3.1.0

func (m *MockRunningBackupsRegistry) GetRoutineState(routine *model.BackupRoutine) model.RoutineState

GetRoutineState mocks base method.

func (*MockRunningBackupsRegistry) GetRunningState added in v3.1.0

func (m *MockRunningBackupsRegistry) GetRunningState() map[string]model.RoutineState

GetRunningState mocks base method.

func (*MockRunningBackupsRegistry) SynchroniseBackupHistory added in v3.1.0

func (m *MockRunningBackupsRegistry) SynchroniseBackupHistory(ctx context.Context, routines []*model.BackupRoutine)

SynchroniseBackupHistory mocks base method.

type MockRunningBackupsRegistryMockRecorder added in v3.1.0

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

MockRunningBackupsRegistryMockRecorder is the mock recorder for MockRunningBackupsRegistry.

func (*MockRunningBackupsRegistryMockRecorder) Cancel added in v3.1.0

func (mr *MockRunningBackupsRegistryMockRecorder) Cancel(routineName any) *gomock.Call

Cancel indicates an expected call of Cancel.

func (*MockRunningBackupsRegistryMockRecorder) GetRoutineState added in v3.1.0

func (mr *MockRunningBackupsRegistryMockRecorder) GetRoutineState(routine any) *gomock.Call

GetRoutineState indicates an expected call of GetRoutineState.

func (*MockRunningBackupsRegistryMockRecorder) GetRunningState added in v3.1.0

func (mr *MockRunningBackupsRegistryMockRecorder) GetRunningState() *gomock.Call

GetRunningState indicates an expected call of GetRunningState.

func (*MockRunningBackupsRegistryMockRecorder) SynchroniseBackupHistory added in v3.1.0

func (mr *MockRunningBackupsRegistryMockRecorder) SynchroniseBackupHistory(ctx, routines any) *gomock.Call

SynchroniseBackupHistory indicates an expected call of SynchroniseBackupHistory.

type MockStartController added in v3.6.0

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

MockStartController is a mock of StartController interface.

func NewMockStartController added in v3.6.0

func NewMockStartController(ctrl *gomock.Controller) *MockStartController

NewMockStartController creates a new mock instance.

func (*MockStartController) EXPECT added in v3.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStartController) HasBackupRunning added in v3.6.0

func (m *MockStartController) HasBackupRunning(routine *model.BackupRoutine) bool

HasBackupRunning mocks base method.

func (*MockStartController) TryStart added in v3.6.0

func (m *MockStartController) TryStart(routine *model.BackupRoutine, now time.Time, backupType model.BackupType) (func(), error)

TryStart mocks base method.

type MockStartControllerMockRecorder added in v3.6.0

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

MockStartControllerMockRecorder is the mock recorder for MockStartController.

func (*MockStartControllerMockRecorder) HasBackupRunning added in v3.6.0

func (mr *MockStartControllerMockRecorder) HasBackupRunning(routine any) *gomock.Call

HasBackupRunning indicates an expected call of HasBackupRunning.

func (*MockStartControllerMockRecorder) TryStart added in v3.6.0

func (mr *MockStartControllerMockRecorder) TryStart(routine, now, backupType any) *gomock.Call

TryStart indicates an expected call of TryStart.

type MockroutineProvider added in v3.5.0

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

MockroutineProvider is a mock of routineProvider interface.

func NewMockroutineProvider added in v3.5.0

func NewMockroutineProvider(ctrl *gomock.Controller) *MockroutineProvider

NewMockroutineProvider creates a new mock instance.

func (*MockroutineProvider) EXPECT added in v3.5.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockroutineProvider) Routines added in v3.5.0

func (m *MockroutineProvider) Routines() map[string]*model.BackupRoutine

Routines mocks base method.

type MockroutineProviderMockRecorder added in v3.5.0

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

MockroutineProviderMockRecorder is the mock recorder for MockroutineProvider.

func (*MockroutineProviderMockRecorder) Routines added in v3.5.0

Routines indicates an expected call of Routines.

type NamespaceBackupRunner added in v3.6.0

type NamespaceBackupRunner interface {
	// Run starts backup execution for a single namespace and returns a cancelable handler.
	// scanLimiter is a per-routine limiter shared across all namespace backups within
	// a single routine run to ensure fair resource allocation.
	Run(
		ctx context.Context,
		routine *model.BackupRoutine,
		namespace string,
		runSpec model.BackupRunSpec,
		scanLimiter syncutil.Limiter,
		logger *slog.Logger,
	) CancelableBackupHandler
}

NamespaceBackupRunner runs the backup pipeline for one namespace: retries, backend cleanup on failure/cancel, and metadata writes on success.

func NewNamespaceBackupRunner added in v3.6.0

func NewNamespaceBackupRunner(
	backupExecutor backupexecutor.Backup,
	backendService BackupWriter,
	pathService PathService,
) NamespaceBackupRunner

NewNamespaceBackupRunner builds a NamespaceBackupRunner from the low-level backup routineRunner, storage writer, and path layout service.

type NamespaceBackupRunnerImpl added in v3.6.0

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

func (*NamespaceBackupRunnerImpl) Run added in v3.6.0

func (e *NamespaceBackupRunnerImpl) Run(
	ctx context.Context,
	routine *model.BackupRoutine,
	namespace string,
	runSpec model.BackupRunSpec,
	scanLimiter syncutil.Limiter,
	logger *slog.Logger,
) CancelableBackupHandler

Run starts a retryable backup for one namespace via backupexecutor.Backup.Run, with cleanup and metadata callbacks wired for the routine's storage layout. scanLimiter is a per-routine limiter shared across all namespace backups within a single routine run to ensure fair resource allocation.

type PathFilter added in v3.1.0

type PathFilter struct {
	BaseFilter
	// contains filtered or unexported fields
}

PathFilter for filtering by explicit path.

func NewPathFilter added in v3.1.0

func NewPathFilter(path string, storage model.Storage) *PathFilter

NewPathFilter creates a filter for retrieving backups directly from a given storage path.

func (*PathFilter) String added in v3.1.0

func (p *PathFilter) String() string

func (*PathFilter) WithFromTime added in v3.1.0

func (p *PathFilter) WithFromTime(fromTime time.Time) *PathFilter

WithFromTime sets the lower bound for Created timestamp filtering.

func (*PathFilter) WithTimeBounds added in v3.1.0

func (p *PathFilter) WithTimeBounds(bounds model.TimeBounds) *PathFilter

WithTimeBounds sets both Created timestamp bounds at once.

func (*PathFilter) WithToTime added in v3.1.0

func (p *PathFilter) WithToTime(toTime time.Time) *PathFilter

WithToTime sets the upper bound for Created timestamp filtering. Returned backups will be finished by given toTime.

type PathService added in v3.4.0

type PathService interface {
	// GetTimestampPath returns a timestamped path for a backup.
	// The path is composed of {routineName}/{backupType}/{timestamp}.
	GetTimestampPath(routineName string, timestamp time.Time, backupType model.BackupType) string

	// GetBackupPath returns the path for a specific namespace backup.
	// The path is composed of {routineName}/{backupType}/{timestamp}/data/{namespace}.
	GetBackupPath(routineName string, backupType model.BackupType, namespace string, timestamp time.Time) string

	// GetConfigurationPath returns the path for a configuration backup.
	// The path is composed of {routineName}/backup/{timestamp}/configuration.
	GetConfigurationPath(routineName string, timestamp time.Time) string

	// GetConfigurationFilePath returns the path for a specific configuration file within a configuration backup.
	// The path is composed of {routineName}/backup/{timestamp}/configuration/{configFile}.
	GetConfigurationFilePath(routineName string, timestamp time.Time, index int) string

	// ExtractTimestampFromPath extracts the timestamp string from a given path.
	ExtractTimestampFromPath(path string) string
}

PathService defines the interface for path-related operations.

type PathServiceImpl added in v3.4.0

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

PathServiceImpl implements the PathService interface.

func NewPathService added in v3.4.0

func NewPathService(format *model.TimestampFormat) *PathServiceImpl

NewPathService creates a new PathServiceImpl.

func (*PathServiceImpl) ExtractTimestampFromPath added in v3.4.0

func (s *PathServiceImpl) ExtractTimestampFromPath(path string) string

ExtractTimestampFromPath extracts the timestamp part from a path.

func (*PathServiceImpl) GetBackupPath added in v3.4.0

func (s *PathServiceImpl) GetBackupPath(
	routineName string,
	backupType model.BackupType,
	namespace string,
	timestamp time.Time,
) string

GetBackupPath returns the path for a specific namespace backup.

func (*PathServiceImpl) GetConfigurationFilePath added in v3.4.0

func (s *PathServiceImpl) GetConfigurationFilePath(routineName string, timestamp time.Time, index int) string

GetConfigurationFilePath returns the path for a specific configuration file.

func (*PathServiceImpl) GetConfigurationPath added in v3.4.0

func (s *PathServiceImpl) GetConfigurationPath(routineName string, timestamp time.Time) string

GetConfigurationPath returns the path for the configuration backup.

func (*PathServiceImpl) GetTimestampPath added in v3.4.0

func (s *PathServiceImpl) GetTimestampPath(
	routineName string,
	timestamp time.Time,
	backupType model.BackupType,
) string

GetTimestampPath returns the timestamped path for a backup.

type RestoreJobsHolder

type RestoreJobsHolder struct {
	*collections.SafeMap[model.RestoreJobID, *restoreJob]
}

RestoreJobsHolder is a thread-safe map of restore jobs.

func NewRestoreJobsHolder

func NewRestoreJobsHolder() *RestoreJobsHolder

NewRestoreJobsHolder returns a new RestoreJobsHolder.

func (*RestoreJobsHolder) StatusCounts added in v3.6.0

func (h *RestoreJobsHolder) StatusCounts() map[model.RestoreState]int

StatusCounts returns counts of restore jobs by status.

type RestoreManager

type RestoreManager interface {
	// Restore starts a restore process using the given request.
	// Returns the job id as a unique identifier.
	Restore(ctx context.Context, request *model.RestoreRequest) (model.RestoreJobID, error)

	// RestoreByTime starts a restore by time process using the given request.
	// Returns the job id as a unique identifier.
	RestoreByTime(ctx context.Context, request *model.RestoreTimestampRequest) (model.RestoreJobID, error)

	// JobStatus returns status for the given job id.
	JobStatus(jobID model.RestoreJobID) (*model.RestoreJobStatus, error)

	// CancelRestore cancels an ongoing restore.
	CancelRestore(jobID model.RestoreJobID) error

	// GetFilteredJobs returns all jobs matching the given filters as a map of jobId -> RestoreJobStatus.
	GetFilteredJobs(
		timeBounds model.TimeBounds,
		statusFilter model.StatusFilter,
	) map[model.RestoreJobID]*model.RestoreJobStatus
}

func NewRestoreManager

func NewRestoreManager(
	restoreService restoreexecutor.Restore,
	clientManager aerospike.ClientManager,
	restoreJobs *RestoreJobsHolder,
	backupReader BackupReader,
	routineStorage *collections.LockMap,
	validator RestoreValidator,
) RestoreManager

NewRestoreManager returns a new RestoreManager implementation.

type RestoreManagerImpl added in v3.5.0

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

RestoreManagerImpl implements the RestoreManager interface. Stores job information locally within a map.

func (*RestoreManagerImpl) CancelRestore added in v3.5.0

func (r *RestoreManagerImpl) CancelRestore(jobID model.RestoreJobID) error

CancelRestore cancels an ongoing restore.

func (*RestoreManagerImpl) GetFilteredJobs added in v3.5.0

func (r *RestoreManagerImpl) GetFilteredJobs(
	timeBounds model.TimeBounds,
	statusFilter model.StatusFilter,
) map[model.RestoreJobID]*model.RestoreJobStatus

GetFilteredJobs returns all jobs matching the given filters as a map of jobId -> RestoreJobStatus.

func (*RestoreManagerImpl) JobStatus added in v3.5.0

JobStatus returns the status of the job with the given id.

func (*RestoreManagerImpl) Restore added in v3.5.0

func (*RestoreManagerImpl) RestoreByTime added in v3.5.0

type RestoreValidator added in v3.5.0

type RestoreValidator interface {
	// ValidatePath validates path-restore preconditions.
	ValidatePath(
		ctx context.Context,
		request *model.RestoreRequest,
		infoGetter backup.InfoGetter,
		backups []model.BackupDetails,
	) error
	// ValidateTimestamp validates point-in-time restore preconditions.
	ValidateTimestamp(
		ctx context.Context,
		request *model.RestoreTimestampRequest,
		infoGetter backup.InfoGetter,
		backupsByNamespace map[string][]model.BackupDetails,
	) error
}

RestoreValidator validates restore preconditions before actual execution starts.

func NewRestoreValidator added in v3.5.0

func NewRestoreValidator(
	startController StartController,
	routines routineProvider,
) RestoreValidator

NewRestoreValidator creates a validator for restore operations.

type RetentionManager

type RetentionManager interface {
	// contains filtered or unexported methods
}

RetentionManager defines the interface for deleting old backups.

type RetentionManagerImpl

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

func NewBackupRetentionManager

func NewBackupRetentionManager(
	backendService BackupReaderWriter,
	routineStorage *collections.LockMap,
) *RetentionManagerImpl

type RoutineBackupRunner added in v3.6.0

type RoutineBackupRunner interface {
	// Run resolves target namespaces and starts one cancelable backup per namespace.
	Run(
		ctx context.Context,
		routine *model.BackupRoutine,
		runSpec model.BackupRunSpec,
		logger *slog.Logger,
	) (*BackupNamespacesOperation, error)
}

RoutineBackupRunner coordinates backup runs for every namespace in a routine.

type RoutineBackupRunnerImpl added in v3.6.0

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

RoutineBackupRunnerImpl implements RoutineBackupRunner by resolving namespaces and delegating each namespace to a NamespaceBackupRunner.

func NewRoutineBackupRunner added in v3.6.0

func NewRoutineBackupRunner(
	nsRunner NamespaceBackupRunner,
	namespaceResolver aerospike.NamespaceResolver,
) *RoutineBackupRunnerImpl

NewRoutineBackupRunner returns an RoutineBackupRunnerImpl using the given per-namespace nsRunner and namespace resolver.

func (*RoutineBackupRunnerImpl) Run added in v3.6.0

Run resolves the namespace list, starts one backup per namespace, and returns the aggregate BackupNamespacesOperation.

type RoutineFilter added in v3.1.0

type RoutineFilter struct {
	BaseFilter
	// contains filtered or unexported fields
}

RoutineFilter for filtering by routine and job type.

func NewFullBackupFilter added in v3.1.0

func NewFullBackupFilter(routine *model.BackupRoutine) *RoutineFilter

NewFullBackupFilter creates a filter for full backups.

func NewIncrementalBackupFilter added in v3.1.0

func NewIncrementalBackupFilter(routine *model.BackupRoutine) *RoutineFilter

NewIncrementalBackupFilter creates a filter for incremental backups.

func (*RoutineFilter) Last added in v3.1.0

func (f *RoutineFilter) Last() *RoutineFilter

Last limits results to backups with the latest Created timestamp among the backups that match the current filter constraints.

func (*RoutineFilter) String added in v3.1.0

func (f *RoutineFilter) String() string

String returns a readable filter representation for logging/debugging.

func (*RoutineFilter) WithFromTime added in v3.1.0

func (f *RoutineFilter) WithFromTime(fromTime time.Time) *RoutineFilter

WithFromTime sets the lower bound for Created timestamp filtering.

func (*RoutineFilter) WithTimeBounds added in v3.1.0

func (f *RoutineFilter) WithTimeBounds(bounds model.TimeBounds) *RoutineFilter

WithTimeBounds sets both Created timestamp bounds at once.

func (*RoutineFilter) WithToTime added in v3.1.0

func (f *RoutineFilter) WithToTime(toTime time.Time) *RoutineFilter

WithToTime sets the upper bound for Created timestamp filtering. Returned backups will be finished by given toTime.

type RunningBackupsRegistry added in v3.1.0

type RunningBackupsRegistry interface {

	// GetRoutineState returns the current backup statistics for a routine.
	GetRoutineState(routine *model.BackupRoutine) model.RoutineState
	// GetRunningState returns statistics for all current backups.
	GetRunningState() map[string]model.RoutineState
	// Cancel stops all ongoing backups for a specific routine.
	Cancel(routineName string)
	// SynchroniseBackupHistory updates the backup registry with the most recent backup timestamps
	// found in the storage backends. It scans provided routines in parallel.
	SynchroniseBackupHistory(ctx context.Context, routines []*model.BackupRoutine)
	// contains filtered or unexported methods
}

RunningBackupsRegistry defines the interface for managing running backups and their statuses.

type RunningBackupsRegistryImpl added in v3.1.0

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

RunningBackupsRegistryImpl implements the RunningBackupsRegistry interface. It acts as a coordinator, managing a map of per-routine trackers.

func NewRunningBackupsRegistry added in v3.1.0

func NewRunningBackupsRegistry(
	history HistoryManager,
	config routineProvider,
) *RunningBackupsRegistryImpl

NewRunningBackupsRegistry creates a new instance of RunningBackupsRegistryImpl.

func (*RunningBackupsRegistryImpl) Cancel added in v3.1.0

func (r *RunningBackupsRegistryImpl) Cancel(routineName string)

Cancel stops all ongoing backups for a specific routine.

func (*RunningBackupsRegistryImpl) GetRoutineState added in v3.1.0

func (r *RunningBackupsRegistryImpl) GetRoutineState(routine *model.BackupRoutine) model.RoutineState

GetRoutineState returns the current backup statistics for a routine.

func (*RunningBackupsRegistryImpl) GetRunningState added in v3.1.0

func (r *RunningBackupsRegistryImpl) GetRunningState() map[string]model.RoutineState

GetRunningState returns statistics for all current backups.

func (*RunningBackupsRegistryImpl) SynchroniseBackupHistory added in v3.1.0

func (r *RunningBackupsRegistryImpl) SynchroniseBackupHistory(ctx context.Context, routines []*model.BackupRoutine)

SynchroniseBackupHistory updates the backup registry with the most recent backup timestamps found in the storage backends. It scans provided routines in parallel.

type StartController added in v3.6.0

type StartController interface {
	// TryStart attempts to reserve a pending-start slot for the given routine and backup type.
	//
	// If admission is denied, Acquire returns an error wrapped with errBackupSkipped.
	// If admission succeeds, it returns a release callback that MUST be called exactly
	// once to clear the reservation.
	TryStart(
		routine *model.BackupRoutine,
		now time.Time,
		backupType model.BackupType,
	) (release func(), err error)
	// HasBackupRunning reports whether a full or incremental backup is active for the
	// routine, including admitted starts not yet visible in the running-backups registry.
	HasBackupRunning(routine *model.BackupRoutine) bool
}

StartController coordinates admission for backup starts.

func NewStartController added in v3.6.0

func NewStartController(
	registry RunningBackupsRegistry,
	policy StartDecider,
) StartController

NewStartController builds a StartController backed by the provided registry and decision policy.

type StartDecider added in v3.6.0

type StartDecider interface {
	// CanStart evaluates admission rules for one start attempt.
	//
	// Returns nil when the start is allowed; otherwise returns a descriptive error
	// that explains why admission must be denied.
	CanStart(
		backupType model.BackupType,
		policy *model.BackupPolicy,
		facts StartFacts,
	) error
}

StartDecider decides whether a backup is allowed to start for a given routine.

Implementations should be pure business logic over StartFacts and routine policy, with no mutation, locking, or I/O side effects.

func NewStartDecider added in v3.6.0

func NewStartDecider() StartDecider

NewStartDecider returns the default StartDecider implementation used by the service.

type StartFacts added in v3.6.0

type StartFacts struct {
	// FullRunningNow reports whether a full backup is currently running or pending start.
	FullRunningNow bool
	// IncrementalRunningNow reports whether an incremental backup is running or pending start.
	IncrementalRunningNow bool
	// HasCompletedFull reports whether at least one full backup completed in history.
	HasCompletedFull bool
	// FullScheduledNow reports whether this tick is a full-backup cron fire time.
	FullScheduledNow bool
}

StartFacts is the admission-time snapshot consumed by StartDecider.CanStart.

The controller builds this snapshot from registry state plus in-memory pending reservations so decision logic can remain deterministic and side-effect free.

type TokenID added in v3.6.0

type TokenID = uuid.UUID

TokenID identifies a single in-flight admission reservation.

Directories

Path Synopsis
Package aerospike is a generated GoMock package.
Package aerospike is a generated GoMock package.
Package backupexecutor is a generated GoMock package.
Package backupexecutor is a generated GoMock package.
Package restoreexecutor is a generated GoMock package.
Package restoreexecutor is a generated GoMock package.

Jump to

Keyboard shortcuts

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