Documentation
¶
Index ¶
- Constants
- func AllocatedFileBytes(_ string, info fs.FileInfo) (int64, bool)
- func AllocationMeasurementSupported() bool
- func CopyDir(src, dst string) error
- func CopyFile(src, dst string) error
- func MovePathWritable(source, destination string) error
- func Realpath(path string) (string, error)
- func RemoveAllWritable(path string) error
- func RemoveIfExists(path string) error
- func ReplaceFile(oldPath, newPath string) error
- func WriteEnvFile(path string, env map[string]string) error
- type Copier
- type CopyEntry
- type CopyOptions
- type CopyProgress
- type CopyReservation
- type CopyStored
Constants ¶
const ( DefaultCopyMaxFiles int64 = 1_000_000 DefaultCopyMaxBytes int64 = 20 << 30 )
Variables ¶
This section is empty.
Functions ¶
func AllocatedFileBytes ¶
AllocatedFileBytes returns filesystem blocks allocated to a regular file.
func AllocationMeasurementSupported ¶
func AllocationMeasurementSupported() bool
func MovePathWritable ¶
MovePathWritable renames one path without following it, temporarily making restrictive source and destination parents owner-writable. Source and destination must be on the same filesystem. Validation uses this to transfer ownership of disposable projected artifacts without allocating a second expanded tree.
func RemoveAllWritable ¶
RemoveAllWritable repairs restrictive copied/cache permissions before cleanup. WalkDir does not follow symlinks, so chmod never escapes path.
func RemoveIfExists ¶
func ReplaceFile ¶
ReplaceFile atomically replaces newPath with oldPath. Replacements targeting the same path are serialized within the process; the platform implementation handles transient operating-system replacement conflicts.
Types ¶
type Copier ¶
type Copier struct {
// contains filtered or unexported fields
}
func NewCopier ¶
func NewCopier(options CopyOptions) *Copier
func (*Copier) Copy ¶
Copy projects source into destination. projectionRoot is the source-side security boundary used for relative paths and symlink validation. A Copier can be reused for several Copy calls so its byte/file limits cover the whole logical projection.
func (*Copier) Progress ¶
func (c *Copier) Progress() CopyProgress
type CopyOptions ¶
type CopyOptions struct {
// MaxFiles and MaxBytes default to conservative finite limits when zero.
// Set either value below zero only for a caller that deliberately wants no
// limit.
MaxFiles int64
MaxBytes int64
Include func(CopyEntry) bool
OnProgress func(CopyProgress)
Reserve func(CopyReservation) error
OnStored func(CopyStored)
}