Documentation
¶
Overview ¶
Package file implements file utils.
Index ¶
- Variables
- func CheckExecutable(file string) error
- func CheckFDLimitSupported() bool
- func CheckFileHandlesSupported() bool
- func FindLibrary(name string, opts ...OpOption) (string, error)
- func GetCurrentProcessUsage() (uint64, error)
- func GetFileHandles() (uint64, uint64, error)
- func GetLimit() (uint64, error)
- func GetUsage() (uint64, error)
- func LocateExecutable(bin string) (string, error)
- func MkdirAllWithTimeout(ctx context.Context, path string, perm os.FileMode) error
- func ReadFileWithTimeout(ctx context.Context, name string) ([]byte, error)
- func StatWithTimeout(ctx context.Context, path string) (os.FileInfo, error)
- func WriteFileWithTimeout(ctx context.Context, name string, data []byte, perm os.FileMode) error
- type Op
- type OpOption
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckExecutable ¶
func CheckFDLimitSupported ¶ added in v0.2.0
func CheckFDLimitSupported() bool
func CheckFileHandlesSupported ¶ added in v0.3.1
func CheckFileHandlesSupported() bool
Returns true if the file handles are supported.
func GetCurrentProcessUsage ¶ added in v0.4.0
Returns the number of allocated file handles for the current process.
func GetFileHandles ¶ added in v0.3.1
Returns the number of allocated file handles and the number of allocated but unused file handles.
func GetLimit ¶ added in v0.2.0
Returns the current file descriptor limit for the host, not for the current process. for the current process, use syscall.Getrlimit.
func GetUsage ¶ added in v0.2.0
"process_open_fds" in prometheus collector ref. https://github.com/prometheus/client_golang/blob/main/prometheus/process_collector_other.go ref. https://pkg.go.dev/github.com/prometheus/procfs
func LocateExecutable ¶
func MkdirAllWithTimeout ¶ added in v0.6.0
MkdirAllWithTimeout performs os.MkdirAll with timeout from context to prevent blocking on unresponsive filesystems like NFS
func ReadFileWithTimeout ¶ added in v0.6.0
ReadFileWithTimeout performs os.ReadFile with timeout from context to prevent blocking on unresponsive filesystems like NFS
func StatWithTimeout ¶ added in v0.6.0
StatWithTimeout performs os.Stat with timeout from context to prevent blocking on unresponsive filesystems like NFS