race

package
v3.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncedReadCloser

type SyncedReadCloser struct {
	// contains filtered or unexported fields
}

SyncedReadCloser is compatible with io.ReadSeeker and performs gate-based synced writes to enable race condition testing.

func NewOpenGateWithTimeout

func NewOpenGateWithTimeout(r io.ReadCloser, d time.Duration) *SyncedReadCloser

NewOpenGateWithTimeout creates a new open gate with a timeout

func NewSyncedReadCloser

func NewSyncedReadCloser(r io.ReadCloser) *SyncedReadCloser

NewSyncedReadCloser creates a new SyncedReadCloser instance.

func (*SyncedReadCloser) Close

func (s *SyncedReadCloser) Close() error

Close closes an io.ReadSeeker

func (*SyncedReadCloser) Len

func (s *SyncedReadCloser) Len() int

Len returns the length of data in reader

func (*SyncedReadCloser) OpenGate

func (s *SyncedReadCloser) OpenGate()

OpenGate opens the gate allowing all requests to be completed

func (*SyncedReadCloser) OpenGateAfter

func (s *SyncedReadCloser) OpenGateAfter(d time.Duration)

OpenGateAfter schedules gate to be opened after a duration

func (*SyncedReadCloser) Read

func (s *SyncedReadCloser) Read(p []byte) (n int, err error)

Read implements read method for io.ReadSeeker

func (*SyncedReadCloser) Seek

func (s *SyncedReadCloser) Seek(offset int64, whence int) (int64, error)

Seek implements seek method for io.ReadSeeker

func (*SyncedReadCloser) SetOpenGate

func (s *SyncedReadCloser) SetOpenGate(status bool)

SetOpenGate sets the status of the blocking gate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL