Documentation
¶
Index ¶
- Variables
- func ByteSize(bytes uint64) string
- func Chmod(path string, mod os.FileMode)
- func CreateFile(path string, size int64)
- func CreateFolder(path string)
- func DoWithRetry(operation func() error, config RetryConfig) error
- func DoWithRetrySimple(operation func() error) error
- func Elapsed(s string, start time.Time)
- func Exit()
- func FadviseWriteDontNeed(file *os.File, offset, length int64)
- func FadviseWriteSequential(file *os.File)
- func Finish()
- func FromByteSize(s string) string
- func GenTempFileName(parts ...string) string
- func GetDstPath(srcPrefix, srcPath, dstPrefix string) string
- func GetFileCRC32C(path string) uint32
- func GetFileMD5(path string) []byte
- func GetFileModificationTime(path string) time.Time
- func GetFileSize(path string) int64
- func GetRelativePath(dir, path string) string
- func GetTempFile(path string) string
- func GetWorkDir() string
- func IsPathDirectory(path string) bool
- func IsPathExist(path string) bool
- func IsPathFile(path string) bool
- func IsSubPath(subPath, path string) bool
- func IsTempFile(path string) bool
- func JoinPath(dir string, parts ...string) string
- func ParseFile(input string) (string, string)
- func ParseObjectUrl(url string) (scheme, bucket, prefix string, err error)
- func ParseURL(input string) (string, string, string)
- func Recovery()
- func SetFileModificationTime(path string, mt time.Time)
- func SetPrefixAsDirectory(prefix string) string
- type RetryConfig
Constants ¶
This section is empty.
Variables ¶
var AppMode bool
var ( // GentleIO controls whether to use gentle I/O for CRC calculation // When true, uses fadviseDontNeed and throttling to reduce cache pollution GentleIO = false )
Functions ¶
func CreateFile ¶
CreateFile creates an empty file with given length (if size > 0)
func DoWithRetry ¶ added in v1.0.28
func DoWithRetry(operation func() error, config RetryConfig) error
DoWithRetry executes a function with retry logic If all retries fail, it returns the last error encountered
func DoWithRetrySimple ¶ added in v1.0.28
DoWithRetrySimple is a simplified version using default retry configuration
func FadviseWriteDontNeed ¶ added in v1.0.33
FadviseWriteDontNeed tells kernel to write back and drop cache for written data
func FadviseWriteSequential ¶ added in v1.0.33
FadviseWriteSequential hints kernel for sequential write pattern
func FromByteSize ¶
FromByteSize converts size string in bytes into uinit, e.g., 1024 into 1K
func GenTempFileName ¶
GenTempFileName generate /tmp/%x files where %x is md5 value of all parts concate together
func GetDstPath ¶
GetDstPath gets the destination path
func GetFileModificationTime ¶
GetFileModificationTime gets mtime of a file
func GetRelativePath ¶
GetRelativePath gets the relative path given path and directory
func GetWorkDir ¶
func GetWorkDir() string
GetWorkDir returns the directory where the executable file put
func IsPathDirectory ¶
IsPathDirectory determines if a path is a directory
func IsSubPath ¶
IsSubPath checks if a path is under another one in directory manner case 1: gs://abc/def -> gs://abc/def : true case 2: gs://abc/def -> gs://abc/de : false case 3: gs://abc/def -> gs://abc/def/ : false case 4: gs://abc/def/-> gs://abc/def/ : true case 5: gs://abc/def/ghi -> gs://abc/def : true case 6: gs://abc/def/ghi -> gs://abc/de : false case 7: gs://abc/def/ghi -> gs://abc/def/ : true
func ParseObjectUrl ¶ added in v1.0.12
func SetFileModificationTime ¶
SetFileModificationTime sets mtime to a file
func SetPrefixAsDirectory ¶
SetPrefixAsDirectory sets the prefix as directory
Types ¶
type RetryConfig ¶ added in v1.0.28
type RetryConfig struct {
MaxAttempts int // Maximum number of attempts (including first attempt)
Delay time.Duration // Delay between retries
Backoff float64 // Multiplier for delay on each retry (1.0 = no backoff)
}
RetryConfig holds configuration for retry behavior
func DefaultRetryConfig ¶ added in v1.0.28
func DefaultRetryConfig() RetryConfig
DefaultRetryConfig returns a reasonable default retry configuration