updateengine

package
v0.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package updateengine provides an interface for communicating with update_engine via D-BUS interface on the host.

Index

Constants

View Source
const (
	// DBusPath is an object path used by update_engine.
	DBusPath = "/com/coreos/update1"
	// DBusDestination is a bus name of update_engine service.
	DBusDestination = "com.coreos.update1"
	// DBusInterface is a update_engine interface name.
	DBusInterface = DBusDestination + ".Manager"
	// DBusSignalNameStatusUpdate is a name of StatusUpdate signal from update_engine interface.
	DBusSignalNameStatusUpdate = "StatusUpdate"
	// DBusMethodNameGetStatus is a name of the method to get current update_engine status.
	DBusMethodNameGetStatus = "GetStatus"
)
View Source
const (
	UpdateStatusIdle                = "UPDATE_STATUS_IDLE"
	UpdateStatusCheckingForUpdate   = "UPDATE_STATUS_CHECKING_FOR_UPDATE"
	UpdateStatusUpdateAvailable     = "UPDATE_STATUS_UPDATE_AVAILABLE"
	UpdateStatusDownloading         = "UPDATE_STATUS_DOWNLOADING"
	UpdateStatusVerifying           = "UPDATE_STATUS_VERIFYING"
	UpdateStatusFinalizing          = "UPDATE_STATUS_FINALIZING"
	UpdateStatusUpdatedNeedReboot   = "UPDATE_STATUS_UPDATED_NEED_REBOOT"
	UpdateStatusReportingErrorEvent = "UPDATE_STATUS_REPORTING_ERROR_EVENT"
)

The possible update statuses returned from the update engine

These correspond to current operation values exposed over DBus and defined by `update_engine`: https://github.com/coreos/update_engine/blob/v0.4.3/src/update_engine/update_attempter.h#L34-L43

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// ReceiveStatuses listens for D-Bus signals coming from update_engine and converts them to Statuses
	// emitted into a given channel. It returns when stop channel gets closed or when the value is sent to it.
	ReceiveStatuses(rcvr chan<- Status, stop <-chan struct{})

	// Close closes underlying connection to the DBus broker. It is up to the user to close the connection
	// and avoid leaking it.
	//
	// Receive statuses call must be stopped before closing the connection.
	Close() error
}

Client allows reading update_engine status using D-Bus.

func New

func New(connector dbus.Connector) (Client, error)

New creates new instance of Client and initializes it.

type DBusConnection added in v0.9.0

type DBusConnection interface {
	Close() error
	AddMatchSignal(...godbus.MatchOption) error
	Signal(chan<- *godbus.Signal)
	Object(string, godbus.ObjectPath) godbus.BusObject
}

DBusConnection is set of methods which client expects D-Bus connection to implement.

type Status

type Status struct {
	LastCheckedTime  int64
	Progress         float64
	CurrentOperation string
	NewVersion       string
	NewSize          int64
}

Status represents status received from update-engine.

func NewStatus

func NewStatus(body []interface{}) Status

NewStatus constructs status from received D-Bus signal body.

func (*Status) String

func (s *Status) String() string

String implements Stringer interface for Status.

Jump to

Keyboard shortcuts

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