Documentation ¶
Index ¶
- Variables
- func FileExists(path string) (bool, error)
- func MapAsString(m map[string]string) string
- func Mkdir(path string, perm os.FileMode) error
- func MyIP() (string, error)
- func Open(path string) (afero.File, error)
- func ReadFile(filename string) (string, error)
- func RemoveAll(path string) error
- func ShortUUID(uuid string) string
- func Stat(path string) (os.FileInfo, error)
- func StrSliceEqual(x, y []string) bool
- func StrStrMapEqual(x, y map[string]string) bool
- func ToTar(name string, permissions int, content string) (io.Reader, error)
- func WaitFor(pred func() bool, interval time.Duration, timeout time.Duration) error
- func Walk(root string, walkFn filepath.WalkFunc) error
- func WriteFile(filename string, data []byte, perm os.FileMode) error
- type EventTimer
- type Formatter
Constants ¶
This section is empty.
Variables ¶
After returns whether the current time is after t. It is stored in a variable so it can be mocked out for unit tests.
var AppFs = afero.NewOsFs()
AppFs is an aero filesystem. It is stored in a variable so that we can replace it with in-memory filesystems for unit tests.
var Sleep = time.Sleep
Sleep stores time.Sleep so we can mock it out for unit tests.
Functions ¶
func FileExists ¶
FileExists checks if the given path corresponds to an existing file in the Afero file system.
func MapAsString ¶
MapAsString creates a deterministic string representing the given map.
func MyIP ¶
MyIP gets the local systems Public IP address as visible on the WAN by querying an exeternal service.
func StrSliceEqual ¶
StrSliceEqual returns true of the string slices 'x' and 'y' are identical.
func StrStrMapEqual ¶
StrStrMapEqual returns true of the string->string maps 'x' and 'y' are equal.
func WaitFor ¶
WaitFor waits until `pred` is satisfied, or `timeout` Duration has passed, checking at every `interval`.
Types ¶
type EventTimer ¶
type EventTimer struct {
// contains filtered or unexported fields
}
EventTimer is a utility struct that allows us to time how long loops take, as well as how often they are triggered.
func NewEventTimer ¶
func NewEventTimer(eventName string) *EventTimer
NewEventTimer creates and returns a ready to use EventTimer
func (*EventTimer) LogEnd ¶
func (ltl *EventTimer) LogEnd()
LogEnd logs the end of a loop and how long it took to run.
func (*EventTimer) LogStart ¶
func (ltl *EventTimer) LogStart()
LogStart logs the start of a loop and how long it has been since the last trigger.