snapshot

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestVersion = uint16(3)
)

Variables

View Source
var (
	ErrBadMagic      = errors.New("snapshot: bad magic")
	ErrBadVersion    = errors.New("snapshot: bad version")
	ErrBadCRC        = errors.New("snapshot: bad crc")
	ErrShortPayload  = errors.New("snapshot: payload too short")
	ErrTrailingBytes = errors.New("snapshot: trailing bytes")
	ErrUnknownPane   = errors.New("snapshot: tree references unknown pane")
	ErrInvalidData   = errors.New("snapshot: invalid data")
)

Functions

func MarshalHead

func MarshalHead(h Head) ([]byte, error)

MarshalHead encodes the deterministic, strict VEVH generation pointer.

func MarshalManifest

func MarshalManifest(m Manifest) ([]byte, error)

func MarshalObject

func MarshalObject(kind ObjectKind, payload []byte) (ports.SnapshotObject, error)

MarshalObject frames payload as VEVO and returns the bytes together with the SHA-256 address of those complete bytes.

Types

type Head struct {
	Generation     uint64
	ManifestDigest SnapshotDigest
}

Head is the repository-owned generation pointer. It is deliberately not a VEVM payload; adapters produce and atomically manage HEAD later.

func UnmarshalHead

func UnmarshalHead(encoded []byte) (Head, error)

UnmarshalHead decodes a complete VEVH generation pointer.

type Manifest

type Manifest struct {
	Generation       uint64
	IncarnationID    domain.IncarnationID
	ParentCheckpoint *domain.CheckpointRef
	Name             string
	CreatedAt        uint64
	Active           uint16
	Tabs             []ManifestTab
}

Manifest is the complete VEVM payload carried directly in a publication.

func UnmarshalManifest

func UnmarshalManifest(encoded []byte) (Manifest, error)

type ManifestPane

type ManifestPane struct {
	ID         layout.PaneID
	StableID   string
	Cwd        string
	Sealed     []ObjectRef
	Tail       ObjectRef
	Transcript ObjectRef
	Process    *Process
}

type ManifestTab

type ManifestTab struct {
	StableID   string
	Cols       uint16
	Rows       uint16
	NextPaneID uint64
	Focus      layout.PaneID
	Tree       *layout.Tree
	Panes      []ManifestPane
}

type ObjectKind

type ObjectKind uint8
const (
	HistoryChunk ObjectKind = iota + 1
	HistoryTail
	RecoveryTranscript
)

func PreflightObject

func PreflightObject(encoded []byte) (ObjectKind, []byte, error)

PreflightObject verifies VEVO framing and declared payload size without copying; the returned payload aliases encoded and is only valid while it is.

func UnmarshalObject

func UnmarshalObject(encoded []byte) (ObjectKind, []byte, error)

type ObjectRef

type ObjectRef struct {
	Kind   ObjectKind
	Digest SnapshotDigest
	Size   uint32
}

type Pane

type Pane struct {
	ID           layout.PaneID
	StableID     string
	Cwd          string
	SealedChunks [][]byte // oldest-first, each a self-contained canonical history blob
	Tail         []byte   // mandatory nonempty canonical history blob
	Transcript   []byte   // mandatory nonempty canonical history blob
	Process      *Process
}

Pane captures terminal state as opaque, canonical VT blobs. Snapshot owns their length framing and order; pkg/vt owns their contents and validation.

type Process

type Process struct {
	Argv     []string
	Strategy string
	Opts     ProcessOpts
}

Process captures restorable foreground process metadata.

type ProcessOpts

type ProcessOpts struct {
	AgentSessionID string
}

ProcessOpts captures strategy-specific process restore options.

type Session

type Session struct {
	Name      string
	CreatedAt uint64
	Active    uint16
	Tabs      []Tab
}

Session is the durable transfer representation for a named daemon session.

func Unmarshal

func Unmarshal(b []byte) (Session, error)

Unmarshal validates the complete manifest and all VT blobs without allocations first, then decodes the already preflighted data.

type SnapshotDigest

type SnapshotDigest = ports.SnapshotDigest

SnapshotDigest is the shared content-address type used by the repository.

func ManifestDigest

func ManifestDigest(encoded []byte) SnapshotDigest

type Tab

type Tab struct {
	StableID   string
	Cols       uint16
	Rows       uint16
	NextPaneID uint64
	Focus      layout.PaneID
	Tree       *layout.Tree
	Panes      []Pane
}

Tab captures one tab's layout, dimensions, and pane snapshots.

Jump to

Keyboard shortcuts

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