modelmigration

package
v0.0.0-...-cf6de95 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterExport

func RegisterExport(
	coordinator Coordinator,
	clock clock.Clock,
	logger logger.Logger,
)

RegisterExport registers the export operations with the given coordinator.

func RegisterImport

func RegisterImport(
	coordinator Coordinator,
	clock clock.Clock,
	logger logger.Logger,
)

RegisterImport registers the import operations with the given coordinator.

Types

type Coordinator

type Coordinator interface {
	// Add adds the given operation to the migration.
	Add(modelmigration.Operation)
}

Coordinator is the interface that is used to add operations to a migration.

type ExportService

type ExportService interface {
	// ExportResources returns the list of application and unit resources to
	// export for the given application.
	//
	// If the application exists but doesn't have any resources, no error are
	// returned, the result just contains an empty list.
	ExportResources(ctx context.Context, name string) (
		resource.ExportedResources,
		error,
	)
}

ExportService provides a subset of the resource domain service methods needed for resource export.

type ImportService

type ImportService interface {
	// ImportResources sets resources imported in migration. It first builds all the
	// resources to insert from the arguments, then inserts them at the end so as to
	// wait as long as possible before turning into a write transaction.
	ImportResources(ctx context.Context, args resource.ImportResourcesArgs) error

	// DeleteImportedResources deletes all imported resource associated with the
	// given applications during an import rollback.
	DeleteImportedResources(
		ctx context.Context,
		appNames []string,
	) error
}

ImportService provides a subset of the resource domain service methods needed for resource import.

Jump to

Keyboard shortcuts

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