update

package
v0.6.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOperationAlreadyInProgress = errors.New("an operation is already in progress")
View Source
var MatchAllPackages = func(p UpgradablePackage) bool {
	return true
}
View Source
var MatchArduinoPackage = func(p UpgradablePackage) bool {
	return strings.HasPrefix(p.Name, "arduino-") ||
		(p.Name == "adbd" && strings.Contains(p.ToVersion, "arduino"))
}

Functions

This section is empty.

Types

type Event

type Event struct {
	Type EventType
	Data string
	Err  error // Optional error field for error events
}

Event represents a single event in the upgrade process.

type EventType

type EventType int

EventType defines the type of upgrade event.

const (
	UpgradeLineEvent EventType = iota
	StartEvent
	RestartEvent
	DoneEvent
	ErrorEvent
)

func (EventType) String

func (t EventType) String() string

type Manager

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

func NewManager

func NewManager(debUpdateService ServiceUpdater, arduinoPlatformUpdateService ServiceUpdater) *Manager

func (*Manager) ListUpgradablePackages

func (m *Manager) ListUpgradablePackages(ctx context.Context, matcher func(UpgradablePackage) bool) ([]UpgradablePackage, error)

func (*Manager) Subscribe

func (b *Manager) Subscribe() chan Event

Subscribe creates a new channel for receiving APT events.

func (*Manager) Unsubscribe

func (b *Manager) Unsubscribe(eventCh chan Event)

Unsubscribe removes the channel from the list of subscribers and closes it.

func (*Manager) UpgradePackages

func (m *Manager) UpgradePackages(ctx context.Context, pkgs []UpgradablePackage) error

type PackageType

type PackageType string
const (
	Arduino PackageType = "arduino-platform"
	Debian  PackageType = "debian-package"
)

func (PackageType) AllowedStatuses

func (s PackageType) AllowedStatuses() []PackageType

type ServiceUpdater

type ServiceUpdater interface {
	ListUpgradablePackages(ctx context.Context, matcher func(UpgradablePackage) bool) ([]UpgradablePackage, error)
	UpgradePackages(ctx context.Context, names []string) (<-chan Event, error)
}

type UpgradablePackage

type UpgradablePackage struct {
	Type         PackageType `json:"type"` // e.g., "arduino", "deb"
	Name         string      `json:"name"` // Package name without repository information
	Architecture string      `json:"-"`
	FromVersion  string      `json:"from_version"`
	ToVersion    string      `json:"to_version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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