statetracker

package
v0.0.0-...-6d4f196 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package statetracker enables the tracking of a limited amount of snap states during long running snap operations: - installation/removal (current download progress during install, ...) - enabling/disabling of snaps,

Note: Once a snap has been marked as "installing" it will remain in that state until it's status as provided by snapd indicates that it is installed on the system. Similarly for removing snaps. Status lifecycle is thus:

"uninstalled" -> "installing" -> "installed" -> "uninstalling" and repeat

Index

Constants

View Source
const (
	// StatusPriced indicates the package is priced and has not been bought.
	StatusPriced = "priced"
	// StatusInstalled indicates the package is in an installed state but disabled.
	StatusInstalled = "installed"
	// StatusActive indicates the package is in an installed and enabled state.
	StatusActive = "active"
	// StatusUninstalled indicates the package is in an uninstalled state.
	StatusUninstalled = "uninstalled"
	// StatusInstalling indicates the package is in an installing state.
	StatusInstalling = "installing"
	// StatusUninstalling indicates the package is in an uninstalling state.
	StatusUninstalling = "uninstalling"
	// StatusEnabling indicates the package is in an enabling state.
	StatusEnabling = "enabling"
	// StatusDisabling indicates the package is in an disabling state.
	StatusDisabling = "disabling"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SnapState

type SnapState struct {
	Status      string
	ChangeID    string
	LocalSize   uint64
	TaskSummary string
}

SnapState encapsulate the currently tracked snap state

type StateTracker

type StateTracker struct {
	sync.Mutex
	// contains filtered or unexported fields
}

StateTracker tracks snap states

func New

func New() *StateTracker

New returns a new status tracker

func (*StateTracker) AllTrackedSnaps

func (s *StateTracker) AllTrackedSnaps() []string

AllTrackedSnaps returns the list of snap names that are currently being tracked

func (*StateTracker) CancelTrackingFor

func (s *StateTracker) CancelTrackingFor(snapName string)

CancelTrackingFor tracks the installation of the given snap

func (*StateTracker) IsTrackedForRunningOperation

func (s *StateTracker) IsTrackedForRunningOperation(snap *client.Snap) (bool, string)

IsTrackedForRunningOperation checks if a given snap is currently concerned by by a running operation

func (*StateTracker) State

State returns the state of the given snap

func (*StateTracker) TrackDisable

func (s *StateTracker) TrackDisable(changeID string, snap *client.Snap)

TrackDisable tracks the disabling of the given snap

func (*StateTracker) TrackEnable

func (s *StateTracker) TrackEnable(changeID string, snap *client.Snap)

TrackEnable tracks the installation of the given snap

func (*StateTracker) TrackInstall

func (s *StateTracker) TrackInstall(changeID string, snap *client.Snap)

TrackInstall tracks the installation of the given snap

func (*StateTracker) TrackUninstall

func (s *StateTracker) TrackUninstall(changeID string, snap *client.Snap)

TrackUninstall tracks the removal of the given snap

Jump to

Keyboard shortcuts

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