refreshstamp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package refreshstamp owns manager-side full-refresh labels, not panel timing. Callers serialize access and authenticate device results before confirmation.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfiguration = errors.New("refreshstamp: timezone required")
	ErrCycle         = errors.New("refreshstamp: stale or conflicting cycle")
	ErrTime          = errors.New("refreshstamp: trusted time unavailable or invalid")
	ErrUnconfirmed   = errors.New("refreshstamp: full resynchronization required")
)
View Source
var ErrOccupied = errors.New("refreshstamp: content occupies reserved corner")

Functions

func Bounds

func Bounds(size display.Size) (image.Rectangle, error)

Bounds derives the reserved rectangle from the existing timestamp font and padding. A smaller display rejects instead of shrinking unreadable glyphs.

func Paint

func Paint(frame display.Frame, label Label) error

Paint modifies only an empty reserved rectangle in borrowed frame storage. Run after HTML composition and before diff/encoding. It never hides visible content; layout-level occupancy diagnostics must be enforced separately. Partial updates pass the exact label returned by Tracker.ForPartial.

Types

type Confirmation

type Confirmation struct {
	Cycle              CycleID
	Started, Completed time.Time
}

Confirmation records historical protocol evidence, not visible acceptance. It remains available after invalidation; ForPartial independently guards reuse.

type CycleID

type CycleID uint64

type Label

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

Label is immutable and constructed only from an explicitly supplied instant.

func (Label) Text

func (l Label) Text() string

type Tracker

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

Tracker is scoped to one coordinator/device session. IDs never repeat within that session. A fresh tracker requires full resync; it cannot restore from a wall clock or the retained e-paper image alone. The zero value rejects Begin.

func New

func New(zone *time.Location) (*Tracker, error)

func (*Tracker) Abort

func (t *Tracker) Abort(id CycleID) error

Abort covers failed or unknown results. No retry and no confirmed time advance. DiscardUnsent is deliberately separate: it requires proof of no device I/O.

func (*Tracker) Begin

func (t *Tracker) Begin(id CycleID, started time.Time) (Label, error)

Begin stages a full cycle without confirming it. The caller establishes clock trust; this function only validates shape/order. No implicit time.Now or UTC fallback. UTC normalization deliberately uses wall instants across processes: https://pkg.go.dev/time#hdr-Monotonic_Clocks

func (*Tracker) Complete

func (t *Tracker) Complete(id CycleID, completed time.Time) error

func (*Tracker) Confirmed

func (t *Tracker) Confirmed() Confirmation

func (*Tracker) DiscardUnsent

func (t *Tracker) DiscardUnsent(id CycleID) error

DiscardUnsent releases preparation only. The caller must prove that no transport operation began; a failed/unknown send MUST use Abort/Invalidate. The old confirmed label survives, but the discarded ID cannot be reused.

func (*Tracker) ForPartial

func (t *Tracker) ForPartial() (Label, error)

func (*Tracker) Invalidate

func (t *Tracker) Invalidate()

Invalidate fences delayed completion after disconnect/reset/ambiguous state. Historical confirmation and used IDs remain; only a new full cycle restores reuse.

Jump to

Keyboard shortcuts

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