pathlib

package
v0.0.0-...-c2df288 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

This package hold common/shared file/path operations used in rcc.

Index

Constants

This section is empty.

Variables

View Source
var (
	Lockless bool
)

Functions

func Abs

func Abs(path string) (string, error)

func Age

func Age(pathname string) uint64

func AppendFile

func AppendFile(filename string, blob []byte) (err error)

func CopyFile

func CopyFile(source, target string, overwrite bool) error

func Create

func Create(filename string) (*os.File, error)

func DaysSinceModified

func DaysSinceModified(filename string) (int, error)

func DirWalk

func DirWalk(directory string, report Report) error

func EnsureDirectory

func EnsureDirectory(directory string) (string, error)

func EnsureDirectoryExists

func EnsureDirectoryExists(directory string) error

func EnsureEmptyDirectory

func EnsureEmptyDirectory(directory string) error

func EnsureParentDirectory

func EnsureParentDirectory(resource string) (string, error)

func EnsureSharedDirectory

func EnsureSharedDirectory(directory string) (string, error)

func EnsureSharedParentDirectory

func EnsureSharedParentDirectory(resource string) (string, error)

func Exists

func Exists(pathname string) bool

func FileExist

func FileExist(name string) bool

func FindNamedPath

func FindNamedPath(basedir, name string) (string, error)

func ForceNothing

func ForceNothing(_ os.FileInfo) bool

func ForceShared

func ForceShared()

func ForceSharedDir

func ForceSharedDir(fullpath string) (string, error)

func ForceTouchWhen

func ForceTouchWhen(location string, when time.Time)

func ForceWalk

func ForceWalk(directory string, force Forced, ignore Ignore, report Report) error

func Glob

func Glob(directory string, pattern string) []string

func HumaneSize

func HumaneSize(pathname string) string

func HumaneSizer

func HumaneSizer(rawsize int64) (float64, string)

func IgnoreDirectories

func IgnoreDirectories(target os.FileInfo) bool

func IgnoreNothing

func IgnoreNothing(_ os.FileInfo) bool

func IsDir

func IsDir(pathname string) bool

func IsEmptyDir

func IsEmptyDir(pathname string) bool

func IsFile

func IsFile(pathname string) bool

func IsSharedDir

func IsSharedDir(fullpath string) bool

func LockWaitMessage

func LockWaitMessage(lockfile, message string) func()

func MakeSharedDir

func MakeSharedDir(fullpath string) (string, error)

func MakeSharedFile

func MakeSharedFile(fullpath string) (string, error)

func Md5

func Md5(filename string) (string, error)

func Modtime

func Modtime(pathname string) (time.Time, error)

func NoReporting

func NoReporting(string, string, os.FileInfo)

func NoteDirectoryContent

func NoteDirectoryContent(context, directory string, guide bool)

func RecursiveGlob

func RecursiveGlob(directory string, pattern string) []string

func RemoveEmptyDirectores

func RemoveEmptyDirectores(starting string) (err error)

func RestrictOwnerOnly

func RestrictOwnerOnly(filename string) error

func Sha256

func Sha256(filename string) (string, error)

func Size

func Size(pathname string) (int64, bool)
func Symlink(pathname string) (string, bool)

func TempDir

func TempDir() string

func TouchWhen

func TouchWhen(location string, when time.Time)

func TryRemove

func TryRemove(context, target string) (err error)

func TryRemoveAll

func TryRemoveAll(context, target string) (err error)

func TryRename

func TryRename(context, source, target string) (err error)

func Walk

func Walk(directory string, ignore Ignore, report Report) error

func WriteFile

func WriteFile(filename string, data []byte, mode os.FileMode) error

Types

type Copier

type Copier func(string, string, bool) error

type Forced

type Forced func(os.FileInfo) bool

func ForceFilename

func ForceFilename(filename string) Forced

type Ignore

type Ignore func(os.FileInfo) bool

func CompositeIgnore

func CompositeIgnore(ignores ...Ignore) Ignore

func IgnorePattern

func IgnorePattern(text string) Ignore

func LoadIgnoreFile

func LoadIgnoreFile(filename string, strict bool) (Ignore, error)

func LoadIgnoreFiles

func LoadIgnoreFiles(filenames []string) (Ignore, error)

type IgnoreNewer

type IgnoreNewer time.Time

func (IgnoreNewer) Ignore

func (it IgnoreNewer) Ignore(candidate os.FileInfo) bool

type IgnoreOlder

type IgnoreOlder time.Time

func (IgnoreOlder) Ignore

func (it IgnoreOlder) Ignore(candidate os.FileInfo) bool

type Locked

type Locked struct {
	*os.File
	Latch chan bool
}

func (Locked) Release

func (it Locked) Release() error

type Lockpid

type Lockpid struct {
	ParentID   int
	ProcessID  int
	Controller string
	Space      string
	Username   string
	Basename   string
}

func LockpidFor

func LockpidFor(filename string) *Lockpid

func (*Lockpid) Erase

func (it *Lockpid) Erase()

func (*Lockpid) Filename

func (it *Lockpid) Filename() string

func (*Lockpid) Keepalive

func (it *Lockpid) Keepalive() chan bool

func (*Lockpid) Location

func (it *Lockpid) Location() string

func (*Lockpid) Message

func (it *Lockpid) Message() string

func (*Lockpid) Touch

func (it *Lockpid) Touch()

type Lockpids

type Lockpids []*Lockpid

func LoadLockpids

func LoadLockpids() (result Lockpids, err error)

func LockHoldersBy

func LockHoldersBy(filename string) (result Lockpids, err error)

type PathParts

type PathParts []string

func EnvironmentPath

func EnvironmentPath(environment []string) PathParts

func PathFrom

func PathFrom(parts ...string) PathParts

func TargetPath

func TargetPath() PathParts

func (PathParts) Absolute

func (it PathParts) Absolute() PathParts

func (PathParts) Append

func (it PathParts) Append(parts ...string) PathParts

func (PathParts) AsEnvironmental

func (it PathParts) AsEnvironmental(name string) string

func (PathParts) Prepend

func (it PathParts) Prepend(parts ...string) PathParts

func (PathParts) Remove

func (it PathParts) Remove(patterns []string) PathParts

func (PathParts) Which

func (it PathParts) Which(application string, extensions []string) (string, bool)

type Releaser

type Releaser interface {
	Release() error
}

func Fake

func Fake() Releaser

func Locker

func Locker(filename string, trycount int) (Releaser, error)

type Report

type Report func(string, string, os.FileInfo)

type Shared

type Shared interface {
	MakeSharedFile(fullpath string) (string, error)
	MakeSharedDir(fullpath string) (string, error)
}

Jump to

Keyboard shortcuts

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