copy

package
v5.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const XDockerContainerPathStatHeader = "X-Docker-Container-Path-Stat"

XDockerContainerPathStatHeader is the *key* in http headers pointing to the base64 encoded JSON payload of stating a path in a container.

Variables

View Source
var ErrENOENT = errors.New("no such file or directory")

ErrENOENT mimics the stdlib's ErrENOENT and can be used to implement custom logic while preserving the user-visible error message.

Functions

func EncodeFileInfo

func EncodeFileInfo(info *FileInfo) (string, error)

EncodeFileInfo serializes the specified FileInfo as a base64 encoded JSON payload. Intended for Docker compat.

func ParseSourceAndDestination

func ParseSourceAndDestination(source, destination string) (string, string, string, string, error)

ParseSourceAndDestination parses the source and destination input into a possibly specified container and path. The input format is described in podman-cp(1) as "[nameOrID:]path". Colons in paths are supported as long they start with a dot or slash.

It returns, in order, the source container and path, followed by the destination container and path, and an error. Note that exactly one container must be specified.

func PreserveBasePath

func PreserveBasePath(original, resolved string) string

PreserveBasePath makes sure that the original base path (e.g., "/" or "./") is preserved. The filepath API among tends to clean up a bit too much but we *must* preserve this data by all means.

Types

type FileInfo

type FileInfo = define.FileInfo

FileInfo describes a file or directory and is returned by (*CopyItem).Stat().

func ExtractFileInfoFromHeader

func ExtractFileInfoFromHeader(header *http.Header) (*FileInfo, error)

ExtractFileInfoFromHeader extracts a base64 encoded JSON payload of a FileInfo in the http header. If no such header entry is found, nil is returned. Intended for Docker compat.

func ResolveHostPath

func ResolveHostPath(path string) (*FileInfo, error)

ResolveHostPath resolves the specified, possibly relative, path on the host.

Jump to

Keyboard shortcuts

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