github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/testutil/backoff.go (about)

     1  package testutil
     2  
     3  import "time"
     4  
     5  // BackoffFunc is an adapter to allow the use of ordinary functions as Backoff.
     6  type BackoffFunc func(n int) <-chan time.Time
     7  
     8  func (f BackoffFunc) Delay(i int) time.Duration {
     9  	return time.Until(<-f(i))
    10  }
    11  
    12  // Wait implements Backoff interface.
    13  func (f BackoffFunc) Wait(n int) <-chan time.Time {
    14  	return f(n)
    15  }