applications

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package applications is a generated GoMock package.

Index

Constants

View Source
const (
	AppTypeLabel            = "appType"
	DefaultImageManifestDir = "/"
)

Variables

This section is empty.

Functions

func NewApplication

func NewApplication(provider provider.Provider) *application

NewApplication creates a new application from an application provider.

Types

type Application

type Application interface {
	// ID is an internal identifier for tracking the application this may or may
	// not be the name provided by the user. How this ID is generated is
	// determined on the application type level.
	ID() string
	// Name is the name of the application as defined by the user. If the name
	// is not populated by the user a name will be generated based on the
	// application type.
	Name() string
	// Type returns the application type.
	AppType() v1alpha1.AppType
	// Path returns the path to the application on the device.
	Path() string
	// Workload returns a workload by name.
	Workload(name string) (*Workload, bool)
	// AddWorkload adds a workload to the application.
	AddWorkload(Workload *Workload)
	// RemoveWorkload removes a workload from the application.
	RemoveWorkload(name string) bool
	// IsEmbedded returns true if the application is embedded.
	IsEmbedded() bool
	// Volume is a volume manager.
	Volume() provider.VolumeManager
	// Status reports the status of an application using the name as defined by
	// the user. In the case there is no name provided it will be populated
	// according to the rules of the application type.
	Status() (*v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, error)
}

type Controller

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

func NewController

func NewController(
	podman *client.Podman,
	manager Manager,
	readWriter fileio.ReadWriter,
	log *log.PrefixLogger,
) *Controller

func (*Controller) Sync

func (c *Controller) Sync(ctx context.Context, current, desired *v1alpha1.DeviceSpec) error

type Manager

type Manager interface {
	// Ensure installs and starts the application on the device using the given provider.
	Ensure(ctx context.Context, provider provider.Provider) error
	// Remove uninstalls the application from the device using the given provider.
	Remove(ctx context.Context, provider provider.Provider) error
	// Update replaces the current application with a new version provided by the given provider.
	Update(ctx context.Context, provider provider.Provider) error
	// BeforeUpdate is called prior to installing an application to ensure the
	// application is valid and dependencies are met.
	BeforeUpdate(ctx context.Context, desired *v1alpha1.DeviceSpec) error
	// AfterUpdate is called after the application has been validated and is ready to be executed.
	AfterUpdate(ctx context.Context) error
	// Stop halts the application running on the device.
	Stop(ctx context.Context) error

	dependency.OCICollector
	status.Exporter
}

Manager coordinates the lifecycle of an application by interacting with its Provider and ensuring it is properly handed off to the appropriate runtime Monitor.

func NewManager

func NewManager(
	log *log.PrefixLogger,
	readWriter fileio.ReadWriter,
	podmanClient *client.Podman,
	systemInfo systeminfo.Manager,
) Manager

type MockApplication

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

MockApplication is a mock of Application interface.

func NewMockApplication

func NewMockApplication(ctrl *gomock.Controller) *MockApplication

NewMockApplication creates a new mock instance.

func (*MockApplication) AddWorkload added in v0.6.0

func (m *MockApplication) AddWorkload(Workload *Workload)

AddWorkload mocks base method.

func (*MockApplication) AppType added in v0.6.0

func (m *MockApplication) AppType() v1alpha1.AppType

AppType mocks base method.

func (*MockApplication) EXPECT

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

func (*MockApplication) ID added in v0.4.0

func (m *MockApplication) ID() string

ID mocks base method.

func (*MockApplication) IsEmbedded

func (m *MockApplication) IsEmbedded() bool

IsEmbedded mocks base method.

func (*MockApplication) Name

func (m *MockApplication) Name() string

Name mocks base method.

func (*MockApplication) Path

func (m *MockApplication) Path() string

Path mocks base method.

func (*MockApplication) RemoveWorkload added in v0.6.0

func (m *MockApplication) RemoveWorkload(name string) bool

RemoveWorkload mocks base method.

func (*MockApplication) Status

Status mocks base method.

func (*MockApplication) Volume added in v0.8.1

Volume mocks base method.

func (*MockApplication) Workload added in v0.6.0

func (m *MockApplication) Workload(name string) (*Workload, bool)

Workload mocks base method.

type MockApplicationMockRecorder

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

MockApplicationMockRecorder is the mock recorder for MockApplication.

func (*MockApplicationMockRecorder) AddWorkload added in v0.6.0

func (mr *MockApplicationMockRecorder) AddWorkload(Workload any) *gomock.Call

AddWorkload indicates an expected call of AddWorkload.

func (*MockApplicationMockRecorder) AppType added in v0.6.0

func (mr *MockApplicationMockRecorder) AppType() *gomock.Call

AppType indicates an expected call of AppType.

func (*MockApplicationMockRecorder) ID added in v0.4.0

ID indicates an expected call of ID.

func (*MockApplicationMockRecorder) IsEmbedded

func (mr *MockApplicationMockRecorder) IsEmbedded() *gomock.Call

IsEmbedded indicates an expected call of IsEmbedded.

func (*MockApplicationMockRecorder) Name

Name indicates an expected call of Name.

func (*MockApplicationMockRecorder) Path

Path indicates an expected call of Path.

func (*MockApplicationMockRecorder) RemoveWorkload added in v0.6.0

func (mr *MockApplicationMockRecorder) RemoveWorkload(name any) *gomock.Call

RemoveWorkload indicates an expected call of RemoveWorkload.

func (*MockApplicationMockRecorder) Status

func (mr *MockApplicationMockRecorder) Status() *gomock.Call

Status indicates an expected call of Status.

func (*MockApplicationMockRecorder) Volume added in v0.8.1

func (mr *MockApplicationMockRecorder) Volume() *gomock.Call

Volume indicates an expected call of Volume.

func (*MockApplicationMockRecorder) Workload added in v0.6.0

func (mr *MockApplicationMockRecorder) Workload(name any) *gomock.Call

Workload indicates an expected call of Workload.

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) AfterUpdate added in v0.4.0

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

AfterUpdate mocks base method.

func (*MockManager) BeforeUpdate added in v0.4.0

func (m *MockManager) BeforeUpdate(ctx context.Context, desired *v1alpha1.DeviceSpec) error

BeforeUpdate mocks base method.

func (*MockManager) CollectOCITargets added in v0.9.0

func (m *MockManager) CollectOCITargets(ctx context.Context, current, desired *v1alpha1.DeviceSpec) ([]dependency.OCIPullTarget, error)

CollectOCITargets 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(ctx context.Context, provider provider.Provider) error

Ensure mocks base method.

func (*MockManager) Remove

func (m *MockManager) Remove(ctx context.Context, provider provider.Provider) error

Remove mocks base method.

func (*MockManager) Status

func (m *MockManager) Status(arg0 context.Context, arg1 *v1alpha1.DeviceStatus, arg2 ...status.CollectorOpt) error

Status mocks base method.

func (*MockManager) Stop

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

Stop mocks base method.

func (*MockManager) Update

func (m *MockManager) Update(ctx context.Context, provider provider.Provider) error

Update mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) AfterUpdate added in v0.4.0

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

AfterUpdate indicates an expected call of AfterUpdate.

func (*MockManagerMockRecorder) BeforeUpdate added in v0.4.0

func (mr *MockManagerMockRecorder) BeforeUpdate(ctx, desired any) *gomock.Call

BeforeUpdate indicates an expected call of BeforeUpdate.

func (*MockManagerMockRecorder) CollectOCITargets added in v0.9.0

func (mr *MockManagerMockRecorder) CollectOCITargets(ctx, current, desired any) *gomock.Call

CollectOCITargets indicates an expected call of CollectOCITargets.

func (*MockManagerMockRecorder) Ensure

func (mr *MockManagerMockRecorder) Ensure(ctx, provider any) *gomock.Call

Ensure indicates an expected call of Ensure.

func (*MockManagerMockRecorder) Remove

func (mr *MockManagerMockRecorder) Remove(ctx, provider any) *gomock.Call

Remove indicates an expected call of Remove.

func (*MockManagerMockRecorder) Status

func (mr *MockManagerMockRecorder) Status(arg0, arg1 any, arg2 ...any) *gomock.Call

Status indicates an expected call of Status.

func (*MockManagerMockRecorder) Stop

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

Stop indicates an expected call of Stop.

func (*MockManagerMockRecorder) Update

func (mr *MockManagerMockRecorder) Update(ctx, provider any) *gomock.Call

Update indicates an expected call of Update.

type MockMonitor

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

MockMonitor is a mock of Monitor interface.

func NewMockMonitor

func NewMockMonitor(ctrl *gomock.Controller) *MockMonitor

NewMockMonitor creates a new mock instance.

func (*MockMonitor) EXPECT

func (m *MockMonitor) EXPECT() *MockMonitorMockRecorder

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

func (*MockMonitor) Run

func (m *MockMonitor) Run(ctx context.Context)

Run mocks base method.

func (*MockMonitor) Status

Status mocks base method.

type MockMonitorMockRecorder

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

MockMonitorMockRecorder is the mock recorder for MockMonitor.

func (*MockMonitorMockRecorder) Run

func (mr *MockMonitorMockRecorder) Run(ctx any) *gomock.Call

Run indicates an expected call of Run.

func (*MockMonitorMockRecorder) Status

func (mr *MockMonitorMockRecorder) Status() *gomock.Call

Status indicates an expected call of Status.

type Monitor

type Monitor interface {
	Run(ctx context.Context)
	Status() []v1alpha1.DeviceApplicationStatus
}

type PodmanMonitor

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

func NewPodmanMonitor

func NewPodmanMonitor(
	log *log.PrefixLogger,
	podman *client.Podman,
	bootTime string,
	writer fileio.Writer,
) *PodmanMonitor

func (*PodmanMonitor) Ensure added in v0.6.0

func (m *PodmanMonitor) Ensure(app Application) error

Ensures that and application is added to the monitor. if the application is added for the first time an Add action is queued to be executed by the lifecycle manager. so additional adds for the same app will be idempotent.

func (*PodmanMonitor) ExecuteActions

func (m *PodmanMonitor) ExecuteActions(ctx context.Context) error

func (*PodmanMonitor) Has added in v0.6.0

func (m *PodmanMonitor) Has(id string) bool

func (*PodmanMonitor) Remove added in v0.6.0

func (m *PodmanMonitor) Remove(app Application) error

func (*PodmanMonitor) Stop

func (m *PodmanMonitor) Stop(ctx context.Context) error

func (*PodmanMonitor) Update added in v0.6.0

func (m *PodmanMonitor) Update(app Application) error

type StatusType added in v0.6.0

type StatusType string
const (
	StatusCreated StatusType = "created"
	StatusInit    StatusType = "init"
	StatusRunning StatusType = "start"
	StatusStop    StatusType = "stop"
	StatusDie     StatusType = "die" // docker only
	StatusDied    StatusType = "died"
	StatusRemove  StatusType = "remove"
	StatusExited  StatusType = "exited"
)

func (StatusType) String added in v0.6.0

func (c StatusType) String() string

type Workload added in v0.6.0

type Workload struct {
	ID       string
	Image    string
	Name     string
	Status   StatusType
	Restarts int
}

Workload represents an application workload tracked by a Monitor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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