modelmigration

package
v0.0.0-...-1592773 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: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterExport

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

RegisterExport registers the export operations with the given coordinator.

func RegisterImport

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

RegisterImport register's a new model migration importer into the supplied coordinator.

Types

type Coordinator

type Coordinator interface {
	Add(modelmigration.Operation)
}

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

type ExportService

type ExportService interface {
	// GetCharmID returns a charm ID by name. It returns an error.CharmNotFound
	// if the charm can not be found by the name.
	// This can also be used as a cheap way to see if a charm exists without
	// needing to load the charm metadata.
	GetCharmID(ctx context.Context, args charm.GetCharmArgs) (corecharm.ID, error)

	// GetCharmByApplicationName returns the charm metadata for the given charm
	// ID. It returns an error.CharmNotFound if the charm can not be found by
	// the ID.
	GetCharmByApplicationName(ctx context.Context, name string) (internalcharm.Charm, charm.CharmLocator, error)

	// GetApplicationConfigAndSettings returns the application config and
	// settings for the specified application. This will return the application
	// config and the settings in one config.ConfigAttributes object.
	//
	// If the application does not exist, a
	// [applicationerrors.ApplicationNotFound] error is returned. If no config
	// is set for the application, an empty config is returned.
	GetApplicationConfigAndSettings(ctx context.Context, name string) (config.ConfigAttributes, application.ApplicationSettings, error)

	// GetApplicationStatus returns the status of the specified application.
	// If the application does not exist, a [applicationerrors.ApplicationNotFound]
	// error is returned.
	GetApplicationStatus(ctx context.Context, name string) (*corestatus.StatusInfo, error)

	// GetApplicationConstraints returns the application constraints for the
	// specified application name.
	// Empty constraints are returned if no constraints exist for the given
	// application ID.
	// If no application is found, an error satisfying
	// [applicationerrors.ApplicationNotFound] is returned.
	GetApplicationConstraints(ctx context.Context, name string) (constraints.Value, error)
}

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

type ImportService

type ImportService interface {
	// ImportApplication registers the existence of an application in the model.
	ImportApplication(context.Context, string, service.ImportApplicationArgs) error

	// RemoveImportedApplication removes an application that was imported. The
	// application might be in an incomplete state, so it's important to remove
	// as much of the application as possible, even on failure.
	RemoveImportedApplication(context.Context, string) error
}

ImportService defines the application service used to import applications from another controller model to this controller.

Jump to

Keyboard shortcuts

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