spec

package
v0.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package spec is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUpgrading added in v0.3.0

func IsUpgrading(current *v1alpha1.RenderedDeviceSpec, desired *v1alpha1.RenderedDeviceSpec) bool

Types

type Item added in v0.3.0

type Item struct {
	Version int64
	Spec    *v1alpha1.RenderedDeviceSpec
}

type ItemHeap added in v0.3.0

type ItemHeap []*Item

ItemHeap is a priority queue that orders items by version.

func (ItemHeap) Len added in v0.3.0

func (h ItemHeap) Len() int

func (ItemHeap) Less added in v0.3.0

func (h ItemHeap) Less(i, j int) bool

func (*ItemHeap) Pop added in v0.3.0

func (h *ItemHeap) Pop() interface{}

func (*ItemHeap) Push added in v0.3.0

func (h *ItemHeap) Push(x interface{})

func (ItemHeap) Swap added in v0.3.0

func (h ItemHeap) Swap(i, j int)

type Manager

type Manager interface {
	// Initialize initializes the current, desired and rollback spec files on
	// disk. If the files already exist, they are overwritten.
	Initialize() error
	// Ensure ensures that spec files exist on disk and re initializes them if they do not.
	Ensure() error
	// Read returns the rendered device spec of the specified type from disk.
	Read(specType Type) (*v1alpha1.RenderedDeviceSpec, error)
	// Upgrade updates the current rendered spec to the desired rendered spec
	// and resets the rollback spec.
	Upgrade() error
	// SetUpgradeFailed marks the desired rendered spec as failed.
	SetUpgradeFailed()
	// IsUpdating returns true if the device is in the process of reconciling the desired spec.
	IsUpgrading() bool
	// IsOSUpdate returns true if an OS update is in progress by checking the current rendered spec.
	IsOSUpdate() (bool, error)
	// CheckOsReconciliation checks if the booted OS image matches the desired OS image.
	CheckOsReconciliation(ctx context.Context) (string, bool, error)
	// IsRollingBack returns true if the device is in a rollback state.
	IsRollingBack(ctx context.Context) (bool, error)
	// PrepareRollback creates a rollback version of the current rendered spec.
	PrepareRollback(ctx context.Context) error
	// Rollback reverts the device to the state of the rollback rendered spec.
	Rollback() error
	// SetClient sets the management API client.
	SetClient(client.Management)
	// GetDesired returns the desired rendered device spec from the management API.
	GetDesired(ctx context.Context) (*v1alpha1.RenderedDeviceSpec, bool, error)
}

func NewManager

func NewManager(
	deviceName string,
	dataDir string,
	deviceReadWriter fileio.ReadWriter,
	bootcClient container.BootcClient,
	backoff wait.Backoff,
	log *log.PrefixLogger,
) Manager

NewManager creates a new device spec manager.

type MockManager

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

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) CheckOsReconciliation

func (m *MockManager) CheckOsReconciliation(ctx context.Context) (string, bool, error)

CheckOsReconciliation mocks base method.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) Ensure

func (m *MockManager) Ensure() error

Ensure mocks base method.

func (*MockManager) GetDesired

GetDesired mocks base method.

func (*MockManager) Initialize

func (m *MockManager) Initialize() error

Initialize mocks base method.

func (*MockManager) IsOSUpdate

func (m *MockManager) IsOSUpdate() (bool, error)

IsOSUpdate mocks base method.

func (*MockManager) IsRollingBack

func (m *MockManager) IsRollingBack(ctx context.Context) (bool, error)

IsRollingBack mocks base method.

func (*MockManager) IsUpgrading added in v0.3.0

func (m *MockManager) IsUpgrading() bool

IsUpgrading mocks base method.

func (*MockManager) PrepareRollback

func (m *MockManager) PrepareRollback(ctx context.Context) error

PrepareRollback mocks base method.

func (*MockManager) Read

func (m *MockManager) Read(specType Type) (*v1alpha1.RenderedDeviceSpec, error)

Read mocks base method.

func (*MockManager) Rollback

func (m *MockManager) Rollback() error

Rollback mocks base method.

func (*MockManager) SetClient

func (m *MockManager) SetClient(arg0 client.Management)

SetClient mocks base method.

func (*MockManager) SetUpgradeFailed added in v0.3.0

func (m *MockManager) SetUpgradeFailed()

SetUpgradeFailed mocks base method.

func (*MockManager) Upgrade

func (m *MockManager) Upgrade() error

Upgrade mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) CheckOsReconciliation

func (mr *MockManagerMockRecorder) CheckOsReconciliation(ctx any) *gomock.Call

CheckOsReconciliation indicates an expected call of CheckOsReconciliation.

func (*MockManagerMockRecorder) Ensure

func (mr *MockManagerMockRecorder) Ensure() *gomock.Call

Ensure indicates an expected call of Ensure.

func (*MockManagerMockRecorder) GetDesired

func (mr *MockManagerMockRecorder) GetDesired(ctx any) *gomock.Call

GetDesired indicates an expected call of GetDesired.

func (*MockManagerMockRecorder) Initialize

func (mr *MockManagerMockRecorder) Initialize() *gomock.Call

Initialize indicates an expected call of Initialize.

func (*MockManagerMockRecorder) IsOSUpdate

func (mr *MockManagerMockRecorder) IsOSUpdate() *gomock.Call

IsOSUpdate indicates an expected call of IsOSUpdate.

func (*MockManagerMockRecorder) IsRollingBack

func (mr *MockManagerMockRecorder) IsRollingBack(ctx any) *gomock.Call

IsRollingBack indicates an expected call of IsRollingBack.

func (*MockManagerMockRecorder) IsUpgrading added in v0.3.0

func (mr *MockManagerMockRecorder) IsUpgrading() *gomock.Call

IsUpgrading indicates an expected call of IsUpgrading.

func (*MockManagerMockRecorder) PrepareRollback

func (mr *MockManagerMockRecorder) PrepareRollback(ctx any) *gomock.Call

PrepareRollback indicates an expected call of PrepareRollback.

func (*MockManagerMockRecorder) Read

func (mr *MockManagerMockRecorder) Read(specType any) *gomock.Call

Read indicates an expected call of Read.

func (*MockManagerMockRecorder) Rollback

func (mr *MockManagerMockRecorder) Rollback() *gomock.Call

Rollback indicates an expected call of Rollback.

func (*MockManagerMockRecorder) SetClient

func (mr *MockManagerMockRecorder) SetClient(arg0 any) *gomock.Call

SetClient indicates an expected call of SetClient.

func (*MockManagerMockRecorder) SetUpgradeFailed added in v0.3.0

func (mr *MockManagerMockRecorder) SetUpgradeFailed() *gomock.Call

SetUpgradeFailed indicates an expected call of SetUpgradeFailed.

func (*MockManagerMockRecorder) Upgrade

func (mr *MockManagerMockRecorder) Upgrade() *gomock.Call

Upgrade indicates an expected call of Upgrade.

type MockPriorityQueue added in v0.3.0

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

MockPriorityQueue is a mock of PriorityQueue interface.

func NewMockPriorityQueue added in v0.3.0

func NewMockPriorityQueue(ctrl *gomock.Controller) *MockPriorityQueue

NewMockPriorityQueue creates a new mock instance.

func (*MockPriorityQueue) Add added in v0.3.0

func (m *MockPriorityQueue) Add(item *Item) error

Add mocks base method.

func (*MockPriorityQueue) Clear added in v0.3.0

func (m *MockPriorityQueue) Clear()

Clear mocks base method.

func (*MockPriorityQueue) EXPECT added in v0.3.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPriorityQueue) IsEmpty added in v0.3.0

func (m *MockPriorityQueue) IsEmpty() bool

IsEmpty mocks base method.

func (*MockPriorityQueue) IsVersionFailed added in v0.3.0

func (m *MockPriorityQueue) IsVersionFailed(version string) bool

IsVersionFailed mocks base method.

func (*MockPriorityQueue) Next added in v0.3.0

func (m *MockPriorityQueue) Next() (*Item, bool)

Next mocks base method.

func (*MockPriorityQueue) Remove added in v0.3.0

func (m *MockPriorityQueue) Remove(version string)

Remove mocks base method.

func (*MockPriorityQueue) SetVersionFailed added in v0.3.0

func (m *MockPriorityQueue) SetVersionFailed(version string)

SetVersionFailed mocks base method.

func (*MockPriorityQueue) Size added in v0.3.0

func (m *MockPriorityQueue) Size() int

Size mocks base method.

type MockPriorityQueueMockRecorder added in v0.3.0

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

MockPriorityQueueMockRecorder is the mock recorder for MockPriorityQueue.

func (*MockPriorityQueueMockRecorder) Add added in v0.3.0

Add indicates an expected call of Add.

func (*MockPriorityQueueMockRecorder) Clear added in v0.3.0

Clear indicates an expected call of Clear.

func (*MockPriorityQueueMockRecorder) IsEmpty added in v0.3.0

func (mr *MockPriorityQueueMockRecorder) IsEmpty() *gomock.Call

IsEmpty indicates an expected call of IsEmpty.

func (*MockPriorityQueueMockRecorder) IsVersionFailed added in v0.3.0

func (mr *MockPriorityQueueMockRecorder) IsVersionFailed(version any) *gomock.Call

IsVersionFailed indicates an expected call of IsVersionFailed.

func (*MockPriorityQueueMockRecorder) Next added in v0.3.0

Next indicates an expected call of Next.

func (*MockPriorityQueueMockRecorder) Remove added in v0.3.0

func (mr *MockPriorityQueueMockRecorder) Remove(version any) *gomock.Call

Remove indicates an expected call of Remove.

func (*MockPriorityQueueMockRecorder) SetVersionFailed added in v0.3.0

func (mr *MockPriorityQueueMockRecorder) SetVersionFailed(version any) *gomock.Call

SetVersionFailed indicates an expected call of SetVersionFailed.

func (*MockPriorityQueueMockRecorder) Size added in v0.3.0

Size indicates an expected call of Size.

type PriorityQueue added in v0.3.0

type PriorityQueue interface {
	// Add adds an item to the queue. If the item is already in the queue, it will be skipped.
	Add(item *Item) error
	// Remove removes an item from the queue.
	Remove(version string)
	// Next returns the next item to process.
	Next() (*Item, bool)
	// Size returns the size of the queue.
	Size() int
	// Clear removes all items from the queue.
	Clear()
	// IsEmpty returns true if the queue is empty.
	IsEmpty() bool
	// SetVersionFailed marks a template version as failed. Failed versions will not be requeued.
	SetVersionFailed(version string)
	// IsVersionFailed returns true if a template version is marked as failed.
	IsVersionFailed(version string) bool
}

type Type

type Type string
const (
	Current  Type = "current"
	Desired  Type = "desired"
	Rollback Type = "rollback"
)

Jump to

Keyboard shortcuts

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