sprites

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sprites implements a keepalive.Listener backed by the Fly Sprites Tasks API (https://docs.sprites.dev/keeping-sprites-running/).

While the agent is active the Listener PUTs a self-expiring task over the local management socket; while present, the task prevents the sprite's last-consumer timer from hibernating the VM. The 5-min lease is the cost safety — a crashed clank-host can't keep the VM alive longer than the lease, regardless of pending work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

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

Listener PUTs /v1/tasks/agents while activity is recent.

func New

func New(lg *log.Logger) *Listener

New constructs a Listener wired to the local Sprites management socket. Passing a nil logger uses log.Default().

func (*Listener) Close

func (l *Listener) Close(ctx context.Context) error

Close issues a best-effort DELETE so the sprite hibernates promptly on graceful shutdown rather than waiting for leaseExpire.

func (*Listener) Tick

func (l *Listener) Tick(ctx context.Context, lastActivity time.Time)

Tick PUTs the lease when lastActivity is recent. No-op on the zero time (no Bump yet) or when activity is older than idleThreshold.

Jump to

Keyboard shortcuts

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