service

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

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

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 is used to get the target Juju agent version for the current model.

func NewService

func NewService(st State, watcherFactory WatcherFactory) *Service

NewService returns a new Service.

func (*Service) GetMachineTargetAgentVersion

func (s *Service) GetMachineTargetAgentVersion(
	ctx context.Context,
	machineName machine.Name,
) (version.Number, error)

GetMachineTargetAgentVersion reports the target agent version that should be running on the provided machine identified by name. The following errors are possible: - machineerrors.MachineNotFound - github.com/juju/juju/domain/model/errors.AgentVersionNotFound

func (*Service) GetModelTargetAgentVersion

func (s *Service) GetModelTargetAgentVersion(ctx context.Context) (version.Number, error)

GetModelTargetAgentVersion returns the agent version for the specified model. The following errors can be returned:

func (*Service) GetUnitTargetAgentVersion

func (s *Service) GetUnitTargetAgentVersion(
	ctx context.Context,
	unitName string,
) (version.Number, error)

GetUnitTargetAgentVersion reports the target agent version that should be being run on the provided unit identified by name. The following errors are possible: - applicationerrors.UnitNotFound - When the unit in question does not exist.

func (*Service) WatchMachineTargetAgentVersion

func (s *Service) WatchMachineTargetAgentVersion(
	ctx context.Context,
	machineName machine.Name,
) (watcher.NotifyWatcher, error)

WatchMachineTargetAgentVersion is responsible for watching the target agent version for machine and reporting when there has been a change via a watcher.NotifyWatcher. The following errors can be expected: - machineerrors.NotFound - When no machine exists for the provided name. - [modelerrors.AgentVersionNotFound] - When there is no target version found.

func (*Service) WatchModelTargetAgentVersion

func (s *Service) WatchModelTargetAgentVersion(ctx context.Context) (watcher.NotifyWatcher, error)

WatchModelTargetAgentVersion is responsible for watching the target agent version of this model and reporting when a change has happened in the version.

func (*Service) WatchUnitTargetAgentVersion

func (s *Service) WatchUnitTargetAgentVersion(
	ctx context.Context,
	unitName string,
) (watcher.NotifyWatcher, error)

WatchUnitTargetAgentVersion is responsible for watching the target agent version for unit and reporting when there has been a change via a watcher.NotifyWatcher. The following errors can be expected: - applicationerrors.UnitNotFound - When no unit exists for the provided name. - [modelerrors.AgentVersionNotFound] - When there is no target version found.

type State

type State interface {
	// CheckMachineExists check to see if the given machine exists in the model. If
	// the machine does not exist an error satisfying
	// [machineerrors.MachineNotFound] is returned.
	CheckMachineExists(context.Context, machine.Name) error

	// CheckUnitExists check to see if the given unit exists in the model. If
	// the unit does not exist an error satisfying
	// [applicationerrors.UnitNotFound] is returned.
	CheckUnitExists(context.Context, string) error

	// GetTargetAgentVersion returns the target agent version for this model.
	GetTargetAgentVersion(context.Context) (version.Number, error)
}

type WatcherFactory

type WatcherFactory interface {
	// NewNamespaceNotifyWatcher returns a new namespace notify watcher
	// for events based on the input change mask.
	NewNamespaceNotifyWatcher(namespace string, changeMask changestream.ChangeType) (watcher.NotifyWatcher, error)
}

WatcherFactory provides a factory for constructing new watchers.

Jump to

Keyboard shortcuts

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