repository

package
v0.0.0-...-880cb89 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const NewRepoID = ""

Variables

View Source
var (
	ErrorRepoAlreadyExists = clues.New("a repository was already initialized with that configuration")
	ErrorBackupNotFound    = clues.New("no backup exists with that id")
)

Functions

func New

func New(
	ctx context.Context,
	acct account.Account,
	st storage.Storage,
	opts control.Options,
	configFileRepoID string,
) (singleRepo *repository, err error)

New constructs a repository that can be used to Initialize or Connect a repo instance.

Types

type BackupGetter

type BackupGetter interface {
	Backup(ctx context.Context, id string) (*backup.Backup, error)
	Backups(ctx context.Context, ids []string) ([]*backup.Backup, *fault.Bus)
	BackupsByTag(ctx context.Context, fs ...store.FilterOption) ([]*backup.Backup, error)
	GetBackupDetails(
		ctx context.Context,
		backupID string,
	) (*details.Details, *backup.Backup, *fault.Bus)
	GetBackupErrors(
		ctx context.Context,
		backupID string,
	) (*fault.Errors, *backup.Backup, *fault.Bus)
}

BackupGetter deals with retrieving metadata about backups from the repository.

type Backuper

type Backuper interface {
	NewBackup(
		ctx context.Context,
		self selectors.Selector,
	) (operations.BackupOperation, error)
	NewBackupWithLookup(
		ctx context.Context,
		self selectors.Selector,
		ins idname.Cacher,
	) (operations.BackupOperation, error)
	DeleteBackups(
		ctx context.Context,
		failOnMissing bool,
		ids ...string,
	) error
}

type ConnConfig

type ConnConfig struct {
	// tells the data provider which service to
	// use for its connection pattern.  Leave empty
	// to skip the provider connection.
	Service path.ServiceType
}

type DataProvider

type DataProvider interface {
	inject.BackupProducer
	// Required for backups right now.
	inject.PopulateProtectedResourceIDAndNamer

	inject.ToServiceHandler

	VerifyAccess(ctx context.Context) error
	DeserializeMetadataFiles(
		ctx context.Context,
		colls []data.RestoreCollection,
	) ([]store.MetadataFile, error)
}

type DataProviderConnector

type DataProviderConnector interface {
	// ConnectDataProvider initializes configurations
	// and establishes the client connection with the
	// data provider for this operation.
	ConnectDataProvider(
		ctx context.Context,
		pst path.ServiceType,
	) error
	// DataProvider retrieves the data provider.
	DataProvider() DataProvider
}

type Debugger

type Debugger interface {
	GetBackupMetadata(
		ctx context.Context,
		sel selectors.Selector,
		backupID string,
		errs *fault.Bus,
	) ([]store.MetadataFile, error)
}

should probably turn into a NewDebug interface like we're doing with the other interfaces

type Exporter

type Exporter interface {
	NewExport(
		ctx context.Context,
		backupID string,
		sel selectors.Selector,
		exportCfg control.ExportConfig,
	) (operations.ExportOperation, error)
}

type InitConfig

type InitConfig struct {
	// tells the data provider which service to
	// use for its connection pattern.  Optional.
	Service       path.ServiceType
	RetentionOpts ctrlRepo.Retention
}

type Repositoryer

type Repositoryer interface {
	Backuper
	BackupGetter
	Restorer
	Exporter
	Debugger
	DataProviderConnector

	Initialize(
		ctx context.Context,
		cfg InitConfig,
	) error
	Connect(
		ctx context.Context,
		cfg ConnConfig,
	) error
	GetID() string
	Close(context.Context) error

	NewMaintenance(
		ctx context.Context,
		mOpts ctrlRepo.Maintenance,
	) (operations.MaintenanceOperation, error)
	NewRetentionConfig(
		ctx context.Context,
		rcOpts ctrlRepo.Retention,
	) (operations.RetentionConfigOperation, error)
	NewPersistentConfig(
		ctx context.Context,
		configOpts ctrlRepo.PersistentConfig,
	) (operations.PersistentConfigOperation, error)

	Counter() *count.Bus
}

type Restorer

type Restorer interface {
	NewRestore(
		ctx context.Context,
		backupID string,
		sel selectors.Selector,
		restoreCfg control.RestoreConfig,
	) (operations.RestoreOperation, error)
}

Jump to

Keyboard shortcuts

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