service

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service provides the API for working with external controllers.

func NewService

func NewService(st State) *Service

NewService returns a new service reference wrapping the input state.

func (*Service) Controller

func (s *Service) Controller(
	ctx context.Context,
	controllerUUID string,
) (*crossmodel.ControllerInfo, error)

Controller returns the controller record.

func (*Service) ControllerForModel

func (s *Service) ControllerForModel(
	ctx context.Context,
	modelUUID string,
) (*crossmodel.ControllerInfo, error)

ControllerForModel returns the controller record that's associated with the modelUUID.

func (*Service) ControllersForModels

func (s *Service) ControllersForModels(
	ctx context.Context,
	modelUUIDs ...string,
) ([]crossmodel.ControllerInfo, error)

ControllersForModels returns the list of controllers which are part of the given modelUUIDs. The resulting MigrationControllerInfo contains the list of models for each controller.

func (*Service) ImportExternalControllers

func (s *Service) ImportExternalControllers(
	ctx context.Context,
	externalControllers []crossmodel.ControllerInfo,
) error

ImportExternalControllers imports the list of MigrationControllerInfo external controllers on one single transaction.

func (*Service) ModelsForController

func (s *Service) ModelsForController(
	ctx context.Context,
	controllerUUID string,
) ([]string, error)

ModelsForController returns the list of model UUIDs for the given controllerUUID.

func (*Service) UpdateExternalController

func (s *Service) UpdateExternalController(
	ctx context.Context, ec crossmodel.ControllerInfo,
) error

UpdateExternalController persists the input controller record and associates it with the input model UUIDs.

type State

type State interface {
	// Controller returns the controller record.
	Controller(ctx context.Context, controllerUUID string) (*crossmodel.ControllerInfo, error)

	// UpdateExternalController persists the input controller
	// record.
	UpdateExternalController(ctx context.Context, ec crossmodel.ControllerInfo) error

	// ModelsForController returns the list of model UUIDs for
	// the given controllerUUID.
	ModelsForController(ctx context.Context, controllerUUID string) ([]string, error)

	// ImportExternalControllers imports the list of MigrationControllerInfo
	// external controllers on one single transaction.
	ImportExternalControllers(ctx context.Context, infos []crossmodel.ControllerInfo) error

	// ControllersForModels returns the list of controllers which
	// are part of the given modelUUIDs.
	// The resulting MigrationControllerInfo contains the list of models
	// for each controller.
	ControllersForModels(ctx context.Context, modelUUIDs ...string) ([]crossmodel.ControllerInfo, error)
}

State describes retrieval and persistence methods for storage.

type WatchableService

type WatchableService struct {
	Service
	// contains filtered or unexported fields
}

WatchableService provides the API for working with external controllers and the ability to create watchers.

func NewWatchableService

func NewWatchableService(st State, watcherFactory WatcherFactory) *WatchableService

NewWatchableService returns a new service reference wrapping the input state.

func (*WatchableService) Watch

Watch returns a watcher that observes changes to external controllers.

type WatcherFactory

type WatcherFactory interface {
	// NewUUIDsWatcher returns a watcher that emits the UUIDs for
	// changes to the input table name that match the input mask.
	NewUUIDsWatcher(string, changestream.ChangeType) (watcher.StringsWatcher, error)
}

WatcherFactory describes methods for creating watchers.

Jump to

Keyboard shortcuts

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