fs

package
v0.0.0-...-2601be8 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowWildcards

func AllowWildcards(ci *CopyInfo)

func AllowXAttrErrors

func AllowXAttrErrors(ci *CopyInfo)

func Chown

func Chown(p string, old *User, fn Chowner) error

func Copy

func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) error

Copy copies files using `cp -a` semantics. Copy is likely unsafe to be used in non-containerized environments.

func GetLinkInfo

func GetLinkInfo(fi os.FileInfo) (uint64, bool)

GetLinkInfo returns an identifier representing the node a hardlink is pointing to. If the file is not hard linked then 0 will be returned.

func MkdirAll

func MkdirAll(path string, perm os.FileMode, user Chowner, tm *time.Time) error

MkdirAll is forked os.MkdirAll

func ResolveWildcards

func ResolveWildcards(root, src string, followLinks bool) ([]string, error)

func StatAtime

func StatAtime(st *syscall.Stat_t) syscall.Timespec

Returns the last-accessed time

func StatMtime

func StatMtime(st *syscall.Stat_t) syscall.Timespec

Returns the last-modified time

func Utimes

func Utimes(p string, tm *time.Time) error

func WithCopyInfo

func WithCopyInfo(ci CopyInfo) func(*CopyInfo)

Types

type Chowner

type Chowner func(*User) (*User, error)

type CopyInfo

type CopyInfo struct {
	Chown             Chowner
	Utime             *time.Time
	AllowWildcards    bool
	Mode              *int
	XAttrErrorHandler XAttrErrorHandler
	CopyDirContents   bool
	FollowLinks       bool
	// Include only files/dirs matching at least one of these patterns
	IncludePatterns []string
	// Exclude files/dir matching any of these patterns (even if they match an include pattern)
	ExcludePatterns []string
	ChangeFunc      fsutil.ChangeFunc
}

type Opt

type Opt func(*CopyInfo)

func WithChangeNotifier

func WithChangeNotifier(fn fsutil.ChangeFunc) Opt

func WithChown

func WithChown(uid, gid int) Opt

func WithExcludePattern

func WithExcludePattern(excludePattern string) Opt

func WithIncludePattern

func WithIncludePattern(includePattern string) Opt

func WithXAttrErrorHandler

func WithXAttrErrorHandler(h XAttrErrorHandler) Opt

type User

type User struct {
	UID, GID int
}

type XAttrErrorHandler

type XAttrErrorHandler func(dst, src, xattrKey string, err error) error

Jump to

Keyboard shortcuts

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