Documentation
¶
Index ¶
- Variables
- func CopyFile(src, dst string) (int64, error)
- func CopyFolder(source, dest string) error
- func CopyFolderWithFilter(source, dest string, includeFilter IncludeFilter) (err error)
- func ExeDir() (string, error)
- func ExecAndCaptureOutput(command string, args ...string) (string, string, error)
- func FileExists(filePath string) bool
- func FindProcess(pid int) (*os.Process, error)
- func GetCurrentProcessTimes() (utime int64, stime int64, err error)
- func GetFirstLineFromFile(netFile string) (string, error)
- func Getrusage(who int, rusage *syscall.Rusage) (err error)
- func IsDir(path string) bool
- func KillProcess(pid int, sig syscall.Signal) error
- func RunFuncWithSpinningCursor(asyncFunc func())
- func SetFdSoftLimit(newLimit uint64) error
- type IncludeFilter
- type WatchdogStreamReader
Constants ¶
This section is empty.
Variables ¶
var ErrWatchdogStreamReaderReaderReachedDataLimit = fmt.Errorf("watchdog stream reader reached data limit")
ErrWatchdogStreamReaderReaderReachedDataLimit is returned when watchdogStreamReader was asked to read beyond the designated data limits
var ErrWatchdogStreamReaderTimerElapsed = fmt.Errorf("watchdog stream reader timer elapsed")
ErrWatchdogStreamReaderTimerElapsed is returned when the watchdogStreamReader was not reset in the past readaheadDuration and read was attempted
Functions ¶
func CopyFile ¶
CopyFile uses io.Copy() to copy a file to another location This was copied from https://opensource.com/article/18/6/copying-files-go
func CopyFolder ¶
CopyFolder recursively copies an entire directory to another location (ignoring symlinks)
func CopyFolderWithFilter ¶
func CopyFolderWithFilter(source, dest string, includeFilter IncludeFilter) (err error)
CopyFolderWithFilter recursively copies an entire directory to another location (ignoring symlinks) with an optional filter function to include/exclude folders or files
func ExeDir ¶
ExeDir returns the absolute path to the current executing binary (not including the filename)
func ExecAndCaptureOutput ¶
ExecAndCaptureOutput runs the specified command and args and captures stdout into a string, returning the string or an error upon completion.
func FileExists ¶
FileExists checks to see if the specified file (or directory) exists
func FindProcess ¶
FindProcess looks for a running process by its pid
func GetCurrentProcessTimes ¶
GetCurrentProcessTimes gets current process kernel and usermode times
func GetFirstLineFromFile ¶
GetFirstLineFromFile retrieves the first line of the specified file.
func KillProcess ¶
KillProcess kills a running OS process
func RunFuncWithSpinningCursor ¶
func RunFuncWithSpinningCursor(asyncFunc func())
RunFuncWithSpinningCursor runs a given function in a go-routine, while displaying a spinning cursor to the CLI
func SetFdSoftLimit ¶
SetFdSoftLimit sets a new file descriptors soft limit.
Types ¶
type IncludeFilter ¶
IncludeFilter is a callback for filtering files and folders encountered while copying with CopyFileWithFilter()
type WatchdogStreamReader ¶
WatchdogStreamReader is the public interface for the watchdogStreamReader implementation.
func MakeWatchdogStreamReader ¶
func MakeWatchdogStreamReader(underlayingReader io.Reader, readSize uint64, readaheadSize uint64, readaheadDuration time.Duration) WatchdogStreamReader
MakeWatchdogStreamReader creates a watchdogStreamReader and initializes it.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package bloom implements Bloom filters.
|
Package bloom implements Bloom filters. |
Package db defines database utility functions.
|
Package db defines database utility functions. |
Package metrics provides a metric logging wrappers for Prometheus server.
|
Package metrics provides a metric logging wrappers for Prometheus server. |
Package timers provides a Clock abstraction useful for simulating timeouts.
|
Package timers provides a Clock abstraction useful for simulating timeouts. |