~/bend-docscommunity

src/vmm/snapdir.bend checks

raw source on the hub · import 0x57252a008df878fb1dc2300a80550c94/src/vmm/snapdir.bend as Snapdir

1 import
import Base

Types

type Date source · line 43 · raw

Data

The civil date of a day count since 1970-01-01 (Howard Hinnant's days_from_civil inverse), as year, month, day.

type Info source · line 118 · raw

Data

A snapshot as listed: its name, when it was taken (seconds since 1970), the snapshot it came from ("" when none: a VM booted fresh), its memory and its disks' own blocks (KiB), and a note.

type Pick source · line 217 · raw

Data

What a command means by its VM: the one named, else the only one running.

Definitions

def Sname.char_ok source · line 22 · raw

@+c:U32 -> Bool

A snapshot's name: 1 to 64 of A-Z a-z 0-9 . _ -, not starting with "." (so never ".", "..", or a temporary folder), so it is one path component on every host.

def Sname.chars_ok source · line 26 · raw

@s:String -> Bool

def Sname.valid source · line 33 · raw

@+s:String -> Bool

def Sname.two source · line 38 · raw

@+x:U32 -> String

Two digits, zero-padded.

def Sname.date source · line 46 · raw

@+days:U32 -> Date

def Sname.of_date source · line 59 · raw

@dt:Date -> @+t:U32 -> String

The default name of a snapshot taken at a time (seconds since 1970, UTC): YYYY-MM-DD-HHMMSS, so names sort as times do.

def Sname.of_time source · line 64 · raw

@+secs:U32 -> String

def Sname.undo source · line 68 · raw

@+secs:U32 -> String

The snapshot a restore takes first, so that the restore can be undone.

def Sname.taken source · line 73 · raw

@xs:List<&2, String> -> @+n:String -> Bool

A generated name (the time's, an undo's) that is taken gets -2, -3, ... (names given by the user are refused instead). fuel: the most tried.

def Sname.unique.go source · line 80 · raw

@fuel:Nat -> @+xs:List<&2, String> -> @+base:String -> @+k:U32 -> String

def Sname.unique source · line 88 · raw

@+base:String -> @+xs:List<&2, String> -> String

def Sdir.root source · line 94 · raw

@+vm:String -> String

def Sdir.dir source · line 97 · raw

@+vm:String -> @+name:String -> String

def Sdir.tmp source · line 100 · raw

@+vm:String -> @+name:String -> String

def Sdir.memory source · line 103 · raw

@+dir:String -> String

def Sdir.disk source · line 106 · raw

@+dir:String -> @+i:U32 -> String

def Sdir.info source · line 109 · raw

@+dir:String -> String

def Sdir.one_line source · line 122 · raw

@s:String -> String

A note is one line: its line breaks become spaces.

def Sdir.info.text source · line 131 · raw

@i:Info -> String

The info file: one "key=value" line each.

def Sdir.field source · line 137 · raw

@lines:List<&2, String> -> @+key:String -> String

A value after "key=" on its line, "" when the key is missing.

def Sdir.num source · line 144 · raw

@+s:String -> U32

def Sdir.info.parse source · line 147 · raw

@+text:String -> Info

def Sdir.time source · line 155 · raw

@i:Info -> U32

def Sdir.name source · line 160 · raw

@i:Info -> String

def Sdir.cmp_of source · line 165 · raw

@r:Pair(Pair(String, String), Cmp) -> Cmp

def Sdir.parent source · line 170 · raw

@i:Info -> String

def Sdir.before source · line 177 · raw

@+a:Info -> @+b:Info -> Bool

a before b: older first; in the same second, a snapshot before the one taken from it, then by name.

def Sdir.insert source · line 185 · raw

@xs:List<&2, Info> -> @+x:Info -> List<&2, Info>

def Sdir.sorted source · line 193 · raw

@xs:List<&2, Info> -> @+acc:List<&2, Info> -> List<&2, Info>

A listing, oldest first (a parent before its child in the same second).

def Sdir.names source · line 200 · raw

@xs:List<&2, Info> -> List<&2, String>

def Sdir.prune source · line 208 · raw

@+xs:List<&2, Info> -> @+keep:U32 -> List<&2, String>

prune --keep N: the snapshots it removes, the oldest past the newest N.

def Vmsel.pick source · line 222 · raw

@+given:String -> @+running:List<&2, String> -> Pick

def Vmsel.why source · line 228 · raw

@p:Pick -> String