state

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package state is agent-vm's folder, ~/.agent-vm (AGENT_VM_STATE_DIR): the user's files (env, volumes, runtime.sh, setup.sh) and agent-vm's markers, one file per VM and fact, named as 0.2 named them.

Index

Constants

View Source
const (
	VersionOf    = ".agent-vm-version-"     // the base's build time it was cloned from
	BuiltByOf    = ".agent-vm-built-by-"    // the agent-vm version that built that base
	SSHFSOf      = ".agent-vm-sshfs-"       // 0.1 migration done
	TermOf       = ".agent-vm-term-"        // the $TERM whose terminfo it has
	FileMountsOf = ".agent-vm-file-mounts-" // single files of ~/.agent-vm/volumes
	MountsOf     = ".agent-vm-mounts-"      // 0.2's record of its shares: only removed now
	CacheOf      = ".agent-vm-sshfs-cache-" // 0.2's record of sshfs's cache: only removed now
	ScratchOf    = ".agent-vm-scratch-"     // a --scratch run, with its pid
	PolicyOf     = ".agent-vm-policy-"      // fingerprint of the network and guarded policies it booted with
)

The markers of a VM.

View Source
const (
	BaseVersion = ".agent-vm-base-version"
	BaseBuiltBy = ".agent-vm-base-built-by"
)

The base template's markers. BaseVersion, written last by setup, says it can be cloned.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir string

Dir is the state folder.

func Default

func Default() (Dir, error)

Default is $AGENT_VM_STATE_DIR, made absolute so that the checks that keep shares away from it compare real locations, or ~/.agent-vm, spelled as paths.Host does.

func (Dir) BaseLabel

func (d Dir) BaseLabel(vm, template string) string

BaseLabel is the base vm was cloned from, for `list`: the agent-vm version that built it, and the day, "-" when not known. The base template describes itself. 0.1.0 recorded no version: a base without one was built by it.

func (Dir) Forget

func (d Dir) Forget(vm, template string) error

Forget removes what is known of vm, once deleted. Deleting the base template retires the marker that says it can be cloned.

func (Dir) Marker

func (d Dir) Marker(kind, vm string) string

Marker is the path of marker kind (one of the ...Of) for vm.

func (Dir) Path

func (d Dir) Path(name string) string

Path is name in the folder.

func (Dir) Read

func (d Dir) Read(name string) string

Read is the content of name in the folder, without its trailing newline, "" when there is none.

func (Dir) ReadMarker

func (d Dir) ReadMarker(kind, vm string) string

ReadMarker is Read for a marker of vm.

func (Dir) Rename

func (d Dir) Rename(from, to string) error

Rename moves what is known of the VM from to its new name to: its markers, and its staged single files (its shares are set again before it next boots, from where they now are).

func (Dir) Write

func (d Dir) Write(name string, data []byte) error

Write replaces name in the folder, made if need be, through a temporary file renamed over it: a reader sees the old content or the new, never part of it. The temporary name does not start like a marker's.

Jump to

Keyboard shortcuts

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