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: 8 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 defines a service for interacting with the underlying state.

func NewService

func NewService(st State, logger logger.Logger) *Service

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

func (*Service) AllBlockDevices

func (s *Service) AllBlockDevices(ctx context.Context) (map[string]blockdevice.BlockDevice, error)

AllBlockDevices returns all block devices in the model, keyed on machine id.

func (*Service) BlockDevices

func (s *Service) BlockDevices(ctx context.Context, machineId string) ([]blockdevice.BlockDevice, error)

BlockDevices returns the block devices for a specified machine.

func (*Service) UpdateBlockDevices

func (s *Service) UpdateBlockDevices(ctx context.Context, machineId string, devices ...blockdevice.BlockDevice) error

UpdateBlockDevices updates the block devices for a specified machine.

type State

type State interface {
	// BlockDevices returns the block devices for a specified machine.
	BlockDevices(ctx context.Context, machineId string) ([]blockdevice.BlockDevice, error)

	// SetMachineBlockDevices updates the block devices for a specified machine.
	SetMachineBlockDevices(ctx context.Context, machineId string, devices ...blockdevice.BlockDevice) error

	// MachineBlockDevices returns all block devices in the model, keyed on
	// machine id.
	MachineBlockDevices(ctx context.Context) ([]blockdevice.MachineBlockDevice, error)

	// WatchBlockDevices returns a new NotifyWatcher watching for
	// changes to block devices associated with the specified machine.
	WatchBlockDevices(ctx context.Context, getWatcher getWatcherFunc, machineId string) (watcher.NotifyWatcher, error)
}

State defines an interface for interacting with the underlying state.

type WatchableService

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

WatchableService defines a service for interacting with the underlying state and the ability to create watchers.

func NewWatchableService

func NewWatchableService(st State, wf WatcherFactory, logger logger.Logger) *WatchableService

NewWatchableService returns a new Service for interacting with the underlying state and the ability to create watchers.

func (*WatchableService) WatchBlockDevices

func (s *WatchableService) WatchBlockDevices(
	ctx context.Context,
	machineId string,
) (watcher.NotifyWatcher, error)

WatchBlockDevices returns a new NotifyWatcher watching for changes to block devices associated with the specified machine.

type WatcherFactory

type WatcherFactory interface {
	NewValueMapperWatcher(
		namespace, changeValue string,
		changeMask changestream.ChangeType,
		mapper 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