assets

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: GPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package assets verifies and reconciles plugin-owned device assets.

Index

Constants

View Source
const (
	ApplicationName            = "bsbctl"
	MaxAssets                  = 128
	MaxAssetBytes        int64 = 64 << 20
	MaxPackageAssetBytes int64 = 256 << 20
)
View Source
const (
	ErrorManifestInvalid    = "asset_manifest_invalid"
	ErrorDeviceUnavailable  = "device_unavailable"
	ErrorLocalVerification  = "local_asset_verification_failed"
	ErrorDeviceVerification = "device_asset_verification_failed"
)

Variables

View Source
var (
	ErrAssetsNotReady    = errors.New("plugin assets are not ready")
	ErrAssetUndeclared   = errors.New("package asset is not declared")
	ErrAssetKindMismatch = errors.New("package asset media type does not match presentation kind")
)

Functions

func StockPath

func StockPath(name, kind string) string

StockPath translates a validated firmware basename according to its element kind. Firmware remains responsible for lookup and fallback within that tree.

func ValidatePackage

func ValidatePackage(value Package) error

func ValidatePluginHashCollisions

func ValidatePluginHashCollisions(pluginIDs []string) error

ValidatePluginHashCollisions rejects two configured plugin IDs that would share the truncated physical asset path prefix.

Types

type Declaration

type Declaration struct {
	Source    string `json:"source"`
	SHA256    string `json:"sha256"`
	Size      int64  `json:"size"`
	MediaType string `json:"media_type"`
}

type Device

type Device interface {
	UploadFile(context.Context, string, string, string) error
	ReadTo(context.Context, string, io.Writer) (int64, error)
	Remove(context.Context, string) error
}

type Package

type Package struct {
	PluginID string
	Version  string
	Root     string
	Enabled  bool
	Assets   []Declaration
}

type Phase

type Phase string
const (
	PhaseAbsent  Phase = "absent"
	PhasePending Phase = "assets_pending"
	PhaseReady   Phase = "ready"
	PhaseError   Phase = "error"
)

type Reconciler

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

func NewReconciler

func NewReconciler(device Device) *Reconciler

func (*Reconciler) CollectGarbage

func (r *Reconciler) CollectGarbage(ctx context.Context, packages []Package)

CollectGarbage removes obsolete content-derived files only after the daemon has applied the verified package's desired plugin state.

func (*Reconciler) InvalidateConnection

func (r *Reconciler) InvalidateConnection()

InvalidateConnection forces package assets through device readback on the next reconciliation because firmware exposes no persistent storage epoch.

func (*Reconciler) Ready

func (r *Reconciler) Ready(pluginID string) bool

func (*Reconciler) ReadyFor

func (r *Reconciler) ReadyFor(value Package) bool

ReadyFor reports readiness only when the verified device mapping belongs to this exact package identity and asset declaration set.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, packages []Package)

Reconcile applies desired packages serially. Device failures become pending state so an offline BUSY Bar does not invalidate durable enablement.

func (*Reconciler) ResolveAudioCue

func (r *Reconciler) ResolveAudioCue(pluginID string, cue presentation.AudioCue) (presentation.ResolvedAudioCue, error)

func (*Reconciler) ResolveScene

func (r *Reconciler) ResolveScene(pluginID string, scene presentation.Scene) (presentation.ResolvedScene, error)

func (*Reconciler) Status

func (r *Reconciler) Status() []State

type State

type State struct {
	PluginID                string    `json:"plugin_id"`
	DesiredVersion          string    `json:"desired_version,omitempty"`
	ObservedVersion         string    `json:"observed_version,omitempty"`
	Phase                   Phase     `json:"phase"`
	FilesVerified           int       `json:"files_verified"`
	BytesVerified           int64     `json:"bytes_verified"`
	ValidationInvalidations uint64    `json:"validation_invalidations"`
	RetryAt                 time.Time `json:"retry_at,omitempty"`
	LastErrorCode           string    `json:"last_error_code,omitempty"`
}

Jump to

Keyboard shortcuts

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