updateengine

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (

	// UpdateStatusUpdatedNeedReboot is the status returned by updateengine on
	// dbus when a reboot is needed
	UpdateStatusUpdatedNeedReboot = "UPDATE_STATUS_UPDATED_NEED_REBOOT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a dbus client subscribed to updateengine status updates

func New

func New() (c *Client, err error)

New returns a Client connected to dbus over a private connection with a subscription to updateengine.

func (*Client) GetStatus

func (c *Client) GetStatus() (result Status, err error)

GetStatus returns the current status of updateengine it returns an error if there is a problem getting the status from dbus

func (*Client) RebootNeededSignal

func (c *Client) RebootNeededSignal(rcvr chan Status, stop chan struct{})

RebootNeededSignal watches the updateengine status update subscription and passes the status on the rcvr channel whenever the status update is UpdateStatusUpdatedNeedReboot. The stop channel terminates the function. This function is intended to be called as a goroutine

type Status

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

Status is a struct containing the information passed by updateengine on every status update.

func NewStatus

func NewStatus(body []interface{}) (s Status)

NewStatus creates a new status from a list of fields. this function will panic at runtime if there are less than five elements in the provided list, or if they are not typed int64, float64, string, string, int64 respectively.

func TryNewStatus added in v0.6.2

func TryNewStatus(signal *dbus.Signal) (Status, error)

TryNewStatus attempts to create a new Status from a list of fields in the dbus.Signal. An error is returned if the signal is nil, has less fields than required, or has a field of incorrect type (types must be int64, float64, string, string, int64 respectively). If successful, the new status is returned.

func (*Status) String

func (s *Status) String() string

String returns a string representation of the Status struct. It is of the form "LastCheckedTime=%v Progress=%v CurrentOperation=%q NewVersion=%v NewSize=%v"

Jump to

Keyboard shortcuts

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