hibernation

package
v1.53.1 Latest Latest
Warning

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

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

Documentation

Overview

Package hibernation provides checkpoint writing and cleanup for hibernated sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	SchemaVersion    int       `json:"schema_version"` // always 1
	SessionID        string    `json:"session_id"`
	SessionTitle     string    `json:"session_title"`
	WorkingDirectory string    `json:"working_directory"`
	Program          string    `json:"program"`
	HibernatedAt     time.Time `json:"hibernated_at"`
	HibernateReason  string    `json:"hibernate_reason"` // "manual", "idle", "resource_pressure"
	ScrollbackFile   string    `json:"scrollback_file"`  // path relative to checkpoint dir
}

Checkpoint holds the metadata saved when a session is hibernated.

type Writer

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

Writer writes checkpoint data to disk.

func NewWriter

func NewWriter(checkpointDir string) *Writer

NewWriter creates a Writer that stores checkpoints under checkpointDir.

func (*Writer) Delete

func (w *Writer) Delete(sessionID string) error

Delete removes the checkpoint directory for a session.

func (*Writer) Write

func (w *Writer) Write(ctx context.Context, c Checkpoint, srcScrollbackPath string) error

Write saves checkpoint metadata and copies the scrollback file.

Layout:

<checkpointDir>/<sessionID>/checkpoint.json
<checkpointDir>/<sessionID>/scrollback.txt   (copy of srcScrollbackPath, if non-empty)

If srcScrollbackPath is empty the scrollback copy step is skipped silently.

Jump to

Keyboard shortcuts

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