updater

package
v0.75.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package updater holds the auto-update domain: the typed State, the daemon-SystemEvent metadata schema, and the Holder that caches the latest state and broadcasts changes. No Wails dependency.

Index

Constants

View Source
const EventStateChanged = "netbird:update:state"

EventStateChanged carries the full State snapshot as payload.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	Emit(name string, data ...any) bool
}

Emitter is the broadcast dependency Holder needs; the Wails app.Event processor satisfies it.

type Holder

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

Holder caches the latest update State and broadcasts changes.

func NewHolder

func NewHolder(emitter Emitter) *Holder

NewHolder constructs an empty-state Holder. A nil emitter skips the broadcast.

func (*Holder) Get

func (h *Holder) Get() State

Get returns a copy of the cached State.

func (*Holder) OnSystemEvent

func (h *Holder) OnSystemEvent(ev *proto.SystemEvent)

OnSystemEvent folds update-related metadata into the cached state, emitting EventStateChanged only on an actual change so repeated daemon snapshots don't produce redundant pushes.

type State

type State struct {
	Available  bool   `json:"available"`
	Version    string `json:"version"`
	Enforced   bool   `json:"enforced"`
	Installing bool   `json:"installing"`
}

State is the typed snapshot of the daemon's update situation. Installing is driven only by the daemon's progress_window:show event; a UI-side Update.Trigger() does not flip it.

Jump to

Keyboard shortcuts

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