Documentation
¶
Index ¶
- func CallWithTimeout(ctx context.Context, fn func() error, timeoutCallback func()) error
- func TestDirectory(t *testing.T) string
- func WaitFor(t *testing.T, p Predicate, timeout time.Duration, message string, ...) bool
- func WrapError(err error, cause error) error
- type ContextRWLocker
- func (c *ContextRWLocker) Lock()
- func (c *ContextRWLocker) LockContext(ctx context.Context) error
- func (c *ContextRWLocker) RLock()
- func (c *ContextRWLocker) RLockContext(ctx context.Context) error
- func (c *ContextRWLocker) RLocker() sync.Locker
- func (c *ContextRWLocker) RUnlock()
- func (c *ContextRWLocker) TryLock() bool
- func (c *ContextRWLocker) TryRLock() bool
- func (c *ContextRWLocker) Unlock()
- type Predicate
- type RWLocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallWithTimeout ¶
CallWithTimeout invokes the given function and waits until either it finishes or the given context finishes. If the context finishes before the function finishes, the timeoutCallback function is invoked.
func TestDirectory ¶
TestDirectory returns a temporary directory for this test only. Calling TestDirectory multiple times for the same instance of t returns a new directory every time.
Types ¶
type ContextRWLocker ¶
type ContextRWLocker struct {
// contains filtered or unexported fields
}
ContextRWLocker returns a RWMutex that supports context cancellation.
func (*ContextRWLocker) Lock ¶
func (c *ContextRWLocker) Lock()
Lock simply calls the underlying lock.
func (*ContextRWLocker) LockContext ¶
func (c *ContextRWLocker) LockContext(ctx context.Context) error
LockContext locks the RWLocker with the given context. If the context is canceled the function will return immediately with the error from the context. It will still acquire the lock on the background, but it will be released immediately.
func (*ContextRWLocker) RLock ¶
func (c *ContextRWLocker) RLock()
RLock simply calls the underlying lock.
func (*ContextRWLocker) RLockContext ¶
func (c *ContextRWLocker) RLockContext(ctx context.Context) error
RLockContext locks the RWLocker with the given context. If the context is canceled the function will return immediately with the error from the context. It will still acquire the lock on the background, but it will be released immediately.
func (*ContextRWLocker) RLocker ¶
func (c *ContextRWLocker) RLocker() sync.Locker
RLocker simply calls the underlying lock.
func (*ContextRWLocker) RUnlock ¶
func (c *ContextRWLocker) RUnlock()
RUnlock simply calls the underlying lock.
func (*ContextRWLocker) TryLock ¶
func (c *ContextRWLocker) TryLock() bool
TryLock simply calls the underlying lock.
func (*ContextRWLocker) TryRLock ¶
func (c *ContextRWLocker) TryRLock() bool
TryRLock simply calls the underlying lock.
func (*ContextRWLocker) Unlock ¶
func (c *ContextRWLocker) Unlock()
Unlock simply calls the underlying lock.