Documentation
¶
Overview ¶
Package storagetransfer provides HTTP streaming of vdisk files and subvolumes to/from presigned S3 URLs. It is used to move a deployment's persistent bytes (zmount disks and VM rootfs layers) between nodes during a contract move. The helpers are shared by both the storage and storage_light modules.
Index ¶
- func DownloadDir(dir, url string) error
- func DownloadDirCompressed(dir, url string, c Compression) error
- func DownloadToFile(path, url string) error
- func DownloadToFileCompressed(path, url string, c Compression) error
- func UploadDir(dir, url string) error
- func UploadDirCompressed(dir, url string, c Compression) error
- func UploadFile(path, url string) error
- func UploadFileCompressed(path, url string, c Compression) error
- type Compression
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadDir ¶
DownloadDir GETs url and extracts the tar stream into `dir`.
func DownloadDirCompressed ¶ added in v1.1.5
func DownloadDirCompressed(dir, url string, c Compression) error
DownloadDirCompressed GETs url, decodes it with c, and extracts the tar into dir.
func DownloadToFile ¶
DownloadToFile GETs url and writes the body into an existing file, truncating it.
func DownloadToFileCompressed ¶ added in v1.1.5
func DownloadToFileCompressed(path, url string, c Compression) error
DownloadToFileCompressed GETs url, decodes it with c, and writes it into the existing file at path, truncating it. A compressed download leaves runs of zeros as holes, so a mostly empty disk stays sparse.
func UploadDir ¶
UploadDir streams a tar of `dir` to url. It uses two passes so it needs no temp file (nodes run from a small tmpfs): pass 1 tars to a byte counter to get the exact Content-Length (presigned PUT rejects chunked encoding), pass 2 tars straight into the request body via an io.Pipe. The source is a paused VM's rootfs, so it is static between the two passes.
func UploadDirCompressed ¶ added in v1.1.5
func UploadDirCompressed(dir, url string, c Compression) error
UploadDirCompressed PUTs a tar of dir to url, encoded with c.
func UploadFile ¶
UploadFile PUTs a seekable file so net/http sets a definite Content-Length (presigned S3/MinIO PUT rejects chunked transfer encoding).
func UploadFileCompressed ¶ added in v1.1.5
func UploadFileCompressed(path, url string, c Compression) error
UploadFileCompressed PUTs the file at path to url, encoded with c.
Types ¶
type Compression ¶ added in v1.1.5
type Compression string
Compression names how a transfer's bytes are encoded on the wire.
The empty value sends them as they are (a raw disk file, a plain tar). Zstd compresses them: a zmount disk is uploaded whole, unused space included, so a 15 GB disk holding 2 GB of files sends 15 GB raw and about 1 GB compressed.
const ( // CompressionNone sends the bytes as they are. CompressionNone Compression = "" // CompressionZstd sends one zstd frame of the bytes. CompressionZstd Compression = "zstd" )
func ParseCompression ¶ added in v1.1.5
func ParseCompression(s string) (Compression, error)
ParseCompression accepts the wire names of the supported encodings.