inject

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupProducer

type BackupProducer interface {
	ProduceBackupCollections(
		ctx context.Context,
		bpc BackupProducerConfig,
		counter *count.Bus,
		errs *fault.Bus,
	) ([]data.BackupCollection, prefixmatcher.StringSetReader, bool, error)

	IsServiceEnableder

	// GetMetadataPaths returns a list of paths that form metadata
	// collections. In case of service that have just a single
	// underlying service like OneDrive or SharePoint, it will mostly
	// just have a single collection per manifest reason, but in the
	// case of groups, it will contain a collection each for the
	// underlying service, for example one per SharePoint site.
	GetMetadataPaths(
		ctx context.Context,
		r inject.RestoreProducer,
		base ReasonAndSnapshotIDer,
		errs *fault.Bus,
	) ([]path.RestorePaths, error)

	Wait() *data.CollectionStats

	// SetRateLimiter selects a rate limiter type for the service being
	// backed up and binds it to the context.
	SetRateLimiter(
		ctx context.Context,
		service path.ServiceType,
		options control.Options,
	) context.Context
}

type BackupProducerConfig

type BackupProducerConfig struct {
	LastBackupVersion   int
	MetadataCollections []data.RestoreCollection
	Options             control.Options
	ProtectedResource   idname.Provider
	Selector            selectors.Selector
}

BackupProducerConfig is a container-of-things for holding options and configurations from various packages, all of which are widely used by backup producers independent of service or data category.

type CacheItemInfoer

type CacheItemInfoer interface {
	// CacheItemInfo is used by the consumer to cache metadata that is
	// sourced from per-item info, but may be valuable to the restore at
	// large.
	// Ex: pairing drive ids with drive names as they appeared at the time
	// of backup.
	CacheItemInfo(v details.ItemInfo)
}

type ExportConsumer

type ExportConsumer interface {
	ProduceExportCollections(
		ctx context.Context,
		backupVersion int,
		exportCfg control.ExportConfig,
		dcs []data.RestoreCollection,
		stats *metrics.ExportStats,
		errs *fault.Bus,
	) ([]export.Collectioner, error)

	CacheItemInfoer
}

type IsServiceEnableder

type IsServiceEnableder interface {
	// IsServiceEnabled checks if the service is enabled for backup/restore
	// for the provided resource owner.
	IsServiceEnabled(
		ctx context.Context,
		service path.ServiceType,
		resourceOwner string,
	) (bool, error)
}

type PopulateProtectedResourceIDAndNamer

type PopulateProtectedResourceIDAndNamer interface {
	// PopulateProtectedResourceIDAndName takes the provided owner identifier and produces
	// the owner's name and ID from that value.  Returns an error if the owner is
	// not recognized by the current tenant.
	//
	// The id-name cacher should be optional.  Some processes will look up all owners in
	// the tenant before reaching this step.  In that case, the data gets handed
	// down for this func to consume instead of performing further queries.  The
	// data gets stored inside the controller instance for later re-use.
	PopulateProtectedResourceIDAndName(
		ctx context.Context,
		owner string,
		ins idname.Cacher,
	) (idname.Provider, error)
}

type ReasonAndSnapshotIDer

type ReasonAndSnapshotIDer interface {
	GetReasons() []identity.Reasoner
	GetSnapshotID() manifest.ID
}

type RepoMaintenancer

type RepoMaintenancer interface {
	RepoMaintenance(ctx context.Context, opts repository.Maintenance) error
}

type RestoreConsumer

type RestoreConsumer interface {
	ConsumeRestoreCollections(
		ctx context.Context,
		rcc RestoreConsumerConfig,
		dcs []data.RestoreCollection,
		errs *fault.Bus,
		ctr *count.Bus,
	) (*details.Details, *data.CollectionStats, error)

	// TODO(ashmrtn): Update the IsServiceEnableder interface once
	// BackupProducer is also switched to service handlers.
	IsServiceEnabled(ctx context.Context, resourceOwner string) (bool, error)

	CacheItemInfoer
	PopulateProtectedResourceIDAndNamer
}

type RestoreConsumerConfig

type RestoreConsumerConfig struct {
	BackupVersion     int
	Options           control.Options
	ProtectedResource idname.Provider
	RestoreConfig     control.RestoreConfig
	Selector          selectors.Selector
}

RestoreConsumerConfig is a container-of-things for holding options and configurations from various packages, all of which are widely used by restore consumers independent of service or data category.

type ServiceHandler

type ServiceHandler interface {
	ExportConsumer
	RestoreConsumer
}

ServiceHandler contains the set of functions required to implement all service-specific functionality for backups, restores, and exports.

type ToServiceHandler

type ToServiceHandler interface {
	NewServiceHandler(
		service path.ServiceType,
	) (ServiceHandler, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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