Documentation ¶
Overview ¶
Copyright 2019 Iguazio Systems Ltd.
Licensed under the Apache License, Version 2.0 (the "License") with an addition restriction as set forth herein. You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
In addition, you may not use the software for any purposes that are illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction.
Copyright 2019 Iguazio Systems Ltd.
Licensed under the Apache License, Version 2.0 (the "License") with an addition restriction as set forth herein. You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
In addition, you may not use the software for any purposes that are illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction.
Index ¶
- func IntSliceContainsInt(slice []int, number int) bool
- func IntSlicesEqual(slice1 []int, slice2 []int) bool
- func MakeRange(min, max int) []int
- func RetryFunc(ctx context.Context, loggerInstance logger.Logger, attempts int, ...) error
- func StringSliceContainsString(slice []string, stringToCheck string) bool
- func StringSlicesEqual(slice1 []string, slice2 []string) bool
- func Uint64SlicesEqual(slice1 []uint64, slice2 []uint64) bool
- type Backoff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntSliceContainsInt ¶
func IntSlicesEqual ¶
func RetryFunc ¶
func RetryFunc(ctx context.Context, loggerInstance logger.Logger, attempts int, retryInterval *time.Duration, backoff *Backoff, fn func(int) (bool, error)) error
give either retryInterval or backoff
func StringSlicesEqual ¶
func Uint64SlicesEqual ¶
Types ¶
type Backoff ¶
type Backoff struct { // Factor is the multiplying factor for each increment step Factor float64 // Jitter eases contention by randomizing backoff steps Jitter bool // Min and Max are the minimum and maximum values of the counter Min, Max time.Duration // contains filtered or unexported fields }
Backoff is a time.Duration counter, starting at Min. After every call to the Duration method the current timing is multiplied by Factor, but it never exceeds Max.
Backoff is not generally concurrent-safe, but the ForAttempt method can be used concurrently.
func (*Backoff) Duration ¶
Duration returns the duration for the current attempt before incrementing the attempt counter. See ForAttempt.
func (*Backoff) ForAttempt ¶
ForAttempt returns the duration for a specific attempt. This is useful if you have a large number of independent Backoffs, but don't want use unnecessary memory storing the Backoff parameters per Backoff. The first attempt should be 0.
ForAttempt is concurrent-safe.