service

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 10 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 upgrade info

func NewService

func NewService(st State, wf WatcherFactory) *Service

NewService returns a new Service for interacting with the underlying state.

func (*Service) ActiveUpgrade

func (s *Service) ActiveUpgrade(ctx context.Context) (upgrade.UUID, error)

ActiveUpgrade returns the uuid of the current active upgrade. If there are no active upgrades, return a NotFound error

func (*Service) CreateUpgrade

func (s *Service) CreateUpgrade(ctx context.Context, previousVersion, targetVersion version.Number) (upgrade.UUID, error)

CreateUpgrade creates an upgrade to and from specified versions If an upgrade is already running/pending, return an AlreadyExists err

func (*Service) IsUpgrading

func (s *Service) IsUpgrading(ctx context.Context) (bool, error)

IsUpgrading returns true if there is an upgrade in progress. This essentially asks is there any upgrades that are not in the terminal states (completed or failed)

func (*Service) SetControllerDone

func (s *Service) SetControllerDone(ctx context.Context, upgradeUUID upgrade.UUID, controllerID string) error

SetControllerDone marks the supplied controllerID as having completed its upgrades. When SetControllerDone is called by the last provisioned controller, the upgrade will be archived.

func (*Service) SetControllerReady

func (s *Service) SetControllerReady(ctx context.Context, upgradeUUID upgrade.UUID, controllerID string) error

SetControllerReady marks the supplied controllerID as being ready to start its upgrade. All provisioned controllers need to be ready before an upgrade can start

func (*Service) SetDBUpgradeCompleted

func (s *Service) SetDBUpgradeCompleted(ctx context.Context, upgradeUUID upgrade.UUID) error

SetDBUpgradeCompleted marks the upgrade as completed in the database

func (*Service) SetDBUpgradeFailed

func (s *Service) SetDBUpgradeFailed(ctx context.Context, upgradeUUID upgrade.UUID) error

SetDBUpgradeFailed marks the upgrade as failed in the database. Manual intervention will be required if this has been invoked.

func (*Service) StartUpgrade

func (s *Service) StartUpgrade(ctx context.Context, upgradeUUID upgrade.UUID) error

StartUpgrade starts the current upgrade if it exists

func (*Service) UpgradeInfo

func (s *Service) UpgradeInfo(ctx context.Context, upgradeUUID upgrade.UUID) (coreupgrade.Info, error)

UpgradeInfo returns the upgrade info for the supplied upgradeUUID

type State

type State interface {
	CreateUpgrade(context.Context, version.Number, version.Number) (upgrade.UUID, error)
	SetControllerReady(context.Context, upgrade.UUID, string) error
	AllProvisionedControllersReady(context.Context, upgrade.UUID) (bool, error)
	StartUpgrade(context.Context, upgrade.UUID) error
	SetControllerDone(context.Context, upgrade.UUID, string) error
	ActiveUpgrade(context.Context) (upgrade.UUID, error)
	SetDBUpgradeCompleted(context.Context, upgrade.UUID) error
	SetDBUpgradeFailed(context.Context, upgrade.UUID) error
	UpgradeInfo(context.Context, upgrade.UUID) (coreupgrade.Info, error)
}

State describes retrieval and persistence methods for upgrade info.

type WatchableService

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

WatchableService provides the API for working with upgrade info

func NewWatchableService

func NewWatchableService(st State, wf WatcherFactory) *WatchableService

NewWatchableService returns a new WatchableService for interacting with the underlying state.

func (*WatchableService) WatchForUpgradeReady

func (s *WatchableService) WatchForUpgradeReady(ctx context.Context, upgradeUUID upgrade.UUID) (watcher.NotifyWatcher, error)

WatchForUpgradeReady creates a watcher which notifies when all controller nodes have been registered, meaning the upgrade is ready to start.

func (*WatchableService) WatchForUpgradeState

func (s *WatchableService) WatchForUpgradeState(ctx context.Context, upgradeUUID upgrade.UUID, state coreupgrade.State) (watcher.NotifyWatcher, error)

WatchForUpgradeState creates a watcher which notifies when the upgrade has reached the given state.

type WatcherFactory

type WatcherFactory interface {
	// NewValueMapperWatcher returns a new namespace watcher
	// for events based on the input change mask and predicate.
	NewValueMapperWatcher(string, string, changestream.ChangeType, eventsource.Mapper) (watcher.NotifyWatcher, 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