status

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 14 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 status is a generated GoMock package.

Index

Constants

View Source
const (
	MaxMessageLength = 250
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectorOpt added in v0.7.0

type CollectorOpt func(*CollectorOpts)

func WithForceCollect added in v0.7.0

func WithForceCollect() CollectorOpt

WithForceCollect forces the collection of status information from all exporters.

type CollectorOpts added in v0.7.0

type CollectorOpts struct {
	// Force forces the collection of status information from all exporters.
	Force bool
}

type Exporter

type Exporter interface {
	// Status collects status information and updates the device status.
	Status(context.Context, *v1beta1.DeviceStatus, ...CollectorOpt) error
}

type Getter added in v0.7.0

type Getter interface {
	// Get returns the device status and is safe to call without a management client.
	Get(context.Context) *v1beta1.DeviceStatus
}

type Manager

type Manager interface {
	Getter
	// Sync collects status information from all exporters and updates the device status.
	Sync(context.Context) error
	// Collect gathers status information from all exporters and is safe to call without a management client.
	Collect(context.Context, ...CollectorOpt) error
	// RegisterStatusExporter registers an exporter to be called when collecting status.
	RegisterStatusExporter(Exporter)
	// RegisterCriticalExporter registers an exporter whose output is used
	// for diff-based PATCH updates when a status change is signaled.
	// Critical exporters use the same Exporter interface as collectors;
	// the diff determines which fields changed.
	RegisterCriticalExporter(Exporter)
	// Update updates the device status with the given update functions.
	Update(ctx context.Context, updateFuncs ...UpdateStatusFn) (*v1beta1.DeviceStatus, error)
	// UpdateCondition updates the device status with the given condition.
	UpdateCondition(context.Context, v1beta1.Condition) error
	// UpdateCritical runs registered patchers on a snapshot of the current
	// status, diffs the result to produce JSON Patch ops (RFC 6902), and
	// sends them via PatchDeviceStatus. Returns nil if no fields changed.
	UpdateCritical(ctx context.Context) error
	// CriticalChangeNotifier returns a callback for components to call when
	// their status changes in a way that warrants an immediate PATCH push.
	CriticalChangeNotifier() func()
	// SetClient sets the management client for the status manager.
	SetClient(client.Management)
	// InvalidateLastStatus clears the in-memory last pushed status so the next Sync will push again.
	InvalidateLastStatus()
}

type ManagerOption added in v1.4.0

type ManagerOption func(*StatusManager)

ManagerOption configures optional StatusManager behavior.

func WithCriticalCh added in v1.4.0

func WithCriticalCh(ch chan struct{}) ManagerOption

WithCriticalCh injects the channel used to signal critical status changes. The StatusManager wraps its write-end in CriticalChangeNotifier().

type MockExporter

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

MockExporter is a mock of Exporter interface.

func NewMockExporter

func NewMockExporter(ctrl *gomock.Controller) *MockExporter

NewMockExporter creates a new mock instance.

func (*MockExporter) EXPECT

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

func (*MockExporter) Status added in v0.4.0

func (m *MockExporter) Status(arg0 context.Context, arg1 *v1beta1.DeviceStatus, arg2 ...CollectorOpt) error

Status mocks base method.

type MockExporterMockRecorder

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

MockExporterMockRecorder is the mock recorder for MockExporter.

func (*MockExporterMockRecorder) Status added in v0.4.0

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

Status indicates an expected call of Status.

type MockGetter added in v0.7.0

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

MockGetter is a mock of Getter interface.

func NewMockGetter added in v0.7.0

func NewMockGetter(ctrl *gomock.Controller) *MockGetter

NewMockGetter creates a new mock instance.

func (*MockGetter) EXPECT added in v0.7.0

func (m *MockGetter) EXPECT() *MockGetterMockRecorder

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

func (*MockGetter) Get added in v0.7.0

Get mocks base method.

type MockGetterMockRecorder added in v0.7.0

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

MockGetterMockRecorder is the mock recorder for MockGetter.

func (*MockGetterMockRecorder) Get added in v0.7.0

func (mr *MockGetterMockRecorder) Get(arg0 any) *gomock.Call

Get indicates an expected call of Get.

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) Collect

func (m *MockManager) Collect(arg0 context.Context, arg1 ...CollectorOpt) error

Collect mocks base method.

func (*MockManager) CriticalChangeNotifier added in v1.4.0

func (m *MockManager) CriticalChangeNotifier() func()

CriticalChangeNotifier 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) Get

Get mocks base method.

func (*MockManager) InvalidateLastStatus added in v1.2.0

func (m *MockManager) InvalidateLastStatus()

InvalidateLastStatus mocks base method.

func (*MockManager) RegisterCriticalExporter added in v1.4.0

func (m *MockManager) RegisterCriticalExporter(arg0 Exporter)

RegisterCriticalExporter mocks base method.

func (*MockManager) RegisterStatusExporter added in v0.4.0

func (m *MockManager) RegisterStatusExporter(arg0 Exporter)

RegisterStatusExporter mocks base method.

func (*MockManager) SetClient

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

SetClient mocks base method.

func (*MockManager) Sync

func (m *MockManager) Sync(arg0 context.Context) error

Sync mocks base method.

func (*MockManager) Update

func (m *MockManager) Update(ctx context.Context, updateFuncs ...UpdateStatusFn) (*v1beta1.DeviceStatus, error)

Update mocks base method.

func (*MockManager) UpdateCondition

func (m *MockManager) UpdateCondition(arg0 context.Context, arg1 v1beta1.Condition) error

UpdateCondition mocks base method.

func (*MockManager) UpdateCritical added in v1.4.0

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

UpdateCritical mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) Collect

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

Collect indicates an expected call of Collect.

func (*MockManagerMockRecorder) CriticalChangeNotifier added in v1.4.0

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

CriticalChangeNotifier indicates an expected call of CriticalChangeNotifier.

func (*MockManagerMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockManagerMockRecorder) InvalidateLastStatus added in v1.2.0

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

InvalidateLastStatus indicates an expected call of InvalidateLastStatus.

func (*MockManagerMockRecorder) RegisterCriticalExporter added in v1.4.0

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

RegisterCriticalExporter indicates an expected call of RegisterCriticalExporter.

func (*MockManagerMockRecorder) RegisterStatusExporter added in v0.4.0

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

RegisterStatusExporter indicates an expected call of RegisterStatusExporter.

func (*MockManagerMockRecorder) SetClient

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

SetClient indicates an expected call of SetClient.

func (*MockManagerMockRecorder) Sync

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

Sync indicates an expected call of Sync.

func (*MockManagerMockRecorder) Update

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

Update indicates an expected call of Update.

func (*MockManagerMockRecorder) UpdateCondition

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

UpdateCondition indicates an expected call of UpdateCondition.

func (*MockManagerMockRecorder) UpdateCritical added in v1.4.0

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

UpdateCritical indicates an expected call of UpdateCritical.

type StatusManager

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

StatusManager aggregates device status from various exporters.

func NewManager

func NewManager(
	deviceName string,
	log *log.PrefixLogger,
	opts ...ManagerOption,
) *StatusManager

NewManager creates a new device status manager.

func (*StatusManager) Collect

func (m *StatusManager) Collect(ctx context.Context, opts ...CollectorOpt) error

func (*StatusManager) CriticalChangeNotifier added in v1.4.0

func (m *StatusManager) CriticalChangeNotifier() func()

CriticalChangeNotifier returns a callback that components should call when their status changes in a way that warrants an immediate PATCH push. If no critical channel was provided via WithCriticalCh, returns a no-op.

func (*StatusManager) Get

func (*StatusManager) InvalidateLastStatus added in v1.2.0

func (m *StatusManager) InvalidateLastStatus()

func (*StatusManager) RegisterCriticalExporter added in v1.4.0

func (m *StatusManager) RegisterCriticalExporter(exporter Exporter)

func (*StatusManager) RegisterStatusExporter added in v0.4.0

func (m *StatusManager) RegisterStatusExporter(exporter Exporter)

func (*StatusManager) ReloadCollect added in v0.7.0

func (m *StatusManager) ReloadCollect(ctx context.Context, _ *config.Config) error

ReloadCollect collects status information from all exporters in the case that the agent receives a SIGHUP signal.

func (*StatusManager) SetClient

func (m *StatusManager) SetClient(managementClient client.Management)

func (*StatusManager) Sync

func (m *StatusManager) Sync(ctx context.Context) error

func (*StatusManager) Update

func (m *StatusManager) Update(ctx context.Context, updateFuncs ...UpdateStatusFn) (*v1beta1.DeviceStatus, error)

func (*StatusManager) UpdateCondition

func (m *StatusManager) UpdateCondition(ctx context.Context, condition v1beta1.Condition) error

func (*StatusManager) UpdateCritical added in v1.4.0

func (m *StatusManager) UpdateCritical(ctx context.Context) error

UpdateCritical runs registered patchers on a deep copy of the current status, diffs the result against the last status the server holds to generate RFC 6902 JSON Patch replace ops, and sends them via PatchDeviceStatus. Returns nil if no fields changed.

type UpdateStatusFn

type UpdateStatusFn func(status *v1beta1.DeviceStatus) error

func SetCondition added in v1.1.0

func SetCondition(condition v1beta1.Condition) UpdateStatusFn

func SetConfig

func SetConfig(configStatus v1beta1.DeviceConfigStatus) UpdateStatusFn

func SetDeviceSummary

func SetDeviceSummary(summaryStatus v1beta1.DeviceSummaryStatus) UpdateStatusFn

func SetOSImage

func SetOSImage(osStatus v1beta1.DeviceOsStatus) UpdateStatusFn

Jump to

Keyboard shortcuts

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