screendelivery

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package screendelivery defines the manager's physical delivery boundary. Only its caller owns scene revisions, refresh timestamps and retry decisions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTransportLost   = errors.New("screen transport lost; delivery requires reconciliation")
	ErrTransportResync = errors.New("screen transport requires a new full baseline")
)
View Source
var (
	ErrRegionInput  = errors.New("screen region: incompatible frames or window rules")
	ErrRegionBudget = errors.New("screen region: damage exceeds partial budget")
)

Functions

This section is empty.

Types

type Cadence

type Cadence struct {
	Policy        refreshpolicy.Policy
	Urgent        time.Time
	PartialPolicy refreshpolicy.Policy
	// contains filtered or unexported fields
}

Cadence belongs to the single transport owner. Unknown completion receives the normal interval even for urgent callers; only a known ACK opens that lane.

func (*Cadence) Complete

func (c *Cadence) Complete(now time.Time) time.Time

func (*Cadence) Configure

func (c *Cadence) Configure(p refreshpolicy.Policy) error

func (*Cadence) ConfigurePartial

func (c *Cadence) ConfigurePartial(p refreshpolicy.Policy) error

ConfigurePartial sets operator budgets before delivery starts. It does not establish peer capability or panel safety, and creates no early permission.

func (*Cadence) Deadline

func (c *Cadence) Deadline(normal time.Time, o refreshpolicy.Options) time.Time

func (*Cadence) Enabled

func (c *Cadence) Enabled() bool

func (*Cadence) Ready

func (c *Cadence) Ready(normal time.Time) Readiness

func (*Cadence) Reset

func (c *Cadence) Reset()

Reset preserves configured policy but revokes every confirmed deadline. The transport must establish a conservative Unknown guard on reconnection.

func (*Cadence) Supports

func (c *Cadence) Supports(caps screenwire.Capabilities) bool

Supports checks the complete configured contract before accepting a peer.

func (*Cadence) Unknown

func (c *Cadence) Unknown(now, existing time.Time, legacy time.Duration) time.Time

Unknown retains the legacy reboot/reconciliation guard and any longer local policy. An urgent interval longer than normal must still be honored.

type Outcome

type Outcome uint8

Outcome resolves only a previously ambiguous Send in the same caller.

const (
	NoPending Outcome = iota
	PendingConfirmed
	PendingUnconfirmed
)

type PolicySender

type PolicySender interface {
	Sender
	ConfigureRefresh(refreshpolicy.Policy) error
	SendWithOptions(context.Context, display.Frame, refreshpolicy.Options) error
}

PolicySender is configured once before its owner starts. Implementations require peer capability negotiation; they must never silently downgrade.

type Readiness

type Readiness struct {
	Pending                Outcome
	NotBefore              time.Time
	UrgentNotBefore        time.Time // Zero means no distinct urgent permission.
	PartialNotBefore       time.Time // Zero means no distinct partial permission.
	PartialUrgentNotBefore time.Time
}

Readiness carries a conservative physical refresh deadline.

type RecoveringSender

type RecoveringSender interface {
	Sender
	Changed() <-chan struct{}
	WaitReady(context.Context) (Readiness, error)
	ResetSession()
}

RecoveringSender is serialized by one pump. Changed is a coalesced wake-up, not ownership transfer; WaitReady may reconcile but must never resend pixels.

type RegionPlan

type RegionPlan struct {
	Bounds   image.Rectangle
	Old, New []byte
}

RegionPlan owns opaque old/new crops of one coherent final scene pair. Empty bounds mean pixel-equivalent frames and no physical update is needed.

func PlanRegion

func PlanRegion(base, target display.Frame, rules RegionRules) (RegionPlan, error)

PlanRegion compares immutable final pixels, never independent DOM patches. Adapted from the project's renderdiff byte-row scan for EPS2's single window. Panel minimum dimensions expand the damage using unchanged pixels from the same snapshots, preserving backgrounds and the confirmed timestamp corner. Non-byte-width displays explicitly require a different adapter or full path.

func (RegionPlan) Wire

func (p RegionPlan) Wire(base [32]byte, options refreshpolicy.Options, policy refreshpolicy.Policy) (screenwire.RegionBegin, error)

Wire binds final crops to the transport's confirmed transaction identity. Validate signed coordinates before narrowing them to the EPS2 u16 fields. Peer viewport/capability validation remains the screen client's responsibility.

type RegionPolicySender

type RegionPolicySender interface {
	PolicySender
	RegionSender
	ConfigurePartial(refreshpolicy.Policy) error
}

RegionPolicySender negotiates both full and partial operator policies before delivery starts. ConfigureRefresh must precede ConfigurePartial.

type RegionRules

type RegionRules struct {
	MinWidth, MinHeight, MaxBytes int
}

RegionRules comes from the selected adapter and operator policy, not HTML. Width is byte aligned. MaxBytes bounds each old/new packed plane allocation.

func (RegionRules) Validate

func (r RegionRules) Validate(size display.Size) error

type RegionSender

type RegionSender interface {
	Sender
	SendRegion(context.Context, RegionPlan, refreshpolicy.Options) error
}

RegionSender consumes immutable prepared crops under the same confirmed baseline as its last successful Send. It never silently performs a full update.

type Sender

type Sender interface {
	Send(context.Context, display.Frame) error
}

Sender confirms a physical full refresh, not merely receipt of bytes.

Jump to

Keyboard shortcuts

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