Documentation ¶
Index ¶
- func PathToProjectRoot() string
- func Retry(maxRetries int, delay time.Duration, f func() error) error
- func RetryWithTimeout(f RetryFunc, period time.Duration, timeout time.Duration, description string) error
- func WriteFile(filePath string, contentBuffer bytes.Buffer) error
- func WriteFileToLog(logger *capnslog.PackageLogger, path string)
- type RetryFunc
- type Set
- func (s *Set) Add(newValue string) bool
- func (s *Set) AddMultiple(values []string)
- func (s *Set) AddSet(other *Set)
- func (s *Set) Contains(value string) bool
- func (s *Set) Copy() *Set
- func (s *Set) Count() int
- func (s *Set) Equals(other *Set) bool
- func (s *Set) Iter() <-chan string
- func (s *Set) Remove(oldValue string) bool
- func (s *Set) Subtract(subset *Set)
- func (s *Set) ToSlice() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PathToProjectRoot ¶ added in v1.5.7
func PathToProjectRoot() string
PathToProjectRoot returns the path to the root of the rook repo on the current host. This is primarily useful for tests.
func Retry ¶ added in v0.7.0
Retry will attempt the given function until it succeeds, up to the given maximum amount of retries, sleeping for the given duration in between attempts.
func RetryWithTimeout ¶ added in v1.6.0
func RetryWithTimeout(f RetryFunc, period time.Duration, timeout time.Duration, description string) error
RetryWithTimeout retries the RetryFunc until the timeout occurs. It will retry once more after the timeout to avoid race conditions at the expense of running for slightly longer than timeout in the timeout/error case. The given description will be output in log/error messages as "... waiting for <description>..."
func WriteFileToLog ¶ added in v0.3.0
func WriteFileToLog(logger *capnslog.PackageLogger, path string)
Types ¶
type RetryFunc ¶ added in v1.6.0
RetryFunc is a function that returns true when it is done and it should be retried no longer. It should return error if there has been an error. The error will be logged if done==false (should keep retrying). The error will be returned by the calling function if done==true (should stop retrying).
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func SetDifference ¶
find items in the left slice that are not in the right slice
func (*Set) Add ¶
Add a value to the set. Returns true if the value was added, false if it already exists.
func (*Set) AddMultiple ¶
Add multiple items more efficiently