Documentation
¶
Overview ¶
Package volume copies a disk image to another node, sending only the blocks the receiving copy lacks. A local volume follows its instance this way: the new node copies the disk while the app keeps running, then, once the app has stopped, a final pass sends just the blocks written since.
receiver --POST summary of its copy (block -> SHA-256)--> owner receiver <-- header, differing and zeroed blocks, end --- owner
Holes and all-zero blocks are never sent, so sparse disks stay sparse. Every block carries its hash, which the receiver checks before writing it.
Index ¶
Constants ¶
const BlockSize = 1 << 20
BlockSize is the unit of comparison and transfer.
Variables ¶
var ErrBusy = errors.New("the volume is still attached to a running instance")
ErrBusy is the owner's answer to a final pass while the disk is still attached to a running VM.
Functions ¶
Types ¶
type Puller ¶
type Puller struct {
Client *http.Client
URL string // the owner's endpoint
Token string
Path string // the local copy, created if needed
// Progress is told the bytes received so far in the current pass.
Progress func(int64)
// contains filtered or unexported fields
}
Puller keeps a local copy of a disk another node serves up to date. It remembers what the copy holds between passes, so later passes only cost the owner's read.
type Stats ¶
type Stats struct {
Blocks int // blocks sent
Bytes int64 // their size
Zeroed int // blocks the receiver had to clear
}
Stats counts what one pass transferred.
type Summary ¶
Summary maps each block holding data to the SHA-256 of its contents. Blocks not listed are holes or all zeros.
func ReadSummary ¶
ReadSummary decodes what a receiver sent.