Documentation
¶
Index ¶
- type BlockedSingleFlight
- type SingleFlightResult
- type WorkerScheduleProbe
- func (p *WorkerScheduleProbe) ReleaseAll()
- func (p *WorkerScheduleProbe) RequireLimitReached(t *testing.T)
- func (p *WorkerScheduleProbe) RequireNeverExceeded(t *testing.T)
- func (p *WorkerScheduleProbe) RequireScheduled(t *testing.T)
- func (p *WorkerScheduleProbe) Schedule(ctx context.Context, worker *sync.Worker)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockedSingleFlight ¶
type BlockedSingleFlight[T any] struct { // contains filtered or unexported fields }
BlockedSingleFlight holds an in-flight SingleFlightGroup.Do call until Release.
func StartBlockedSingleFlight ¶
func StartBlockedSingleFlight[T any]( g *sync.SingleFlightGroup[T], key string, fn func() (T, error), ) *BlockedSingleFlight[T]
StartBlockedSingleFlight starts a SingleFlightGroup.Do call and waits until Release before invoking fn.
func (*BlockedSingleFlight[T]) Release ¶
func (b *BlockedSingleFlight[T]) Release()
Release unblocks the SingleFlightGroup.Do function.
func (*BlockedSingleFlight[T]) Result ¶
func (b *BlockedSingleFlight[T]) Result() SingleFlightResult[T]
Result returns the completed SingleFlightGroup.Do result.
func (*BlockedSingleFlight[T]) WaitStarted ¶
func (b *BlockedSingleFlight[T]) WaitStarted()
WaitStarted blocks until the SingleFlightGroup.Do function has started.
type SingleFlightResult ¶
SingleFlightResult captures the values returned by SingleFlightGroup.Do.
func DoSingleFlight ¶
func DoSingleFlight[T any](g *sync.SingleFlightGroup[T], key string, fn func() (T, error)) SingleFlightResult[T]
DoSingleFlight calls SingleFlightGroup.Do and returns the results as a single value.
type WorkerScheduleProbe ¶
type WorkerScheduleProbe struct {
// contains filtered or unexported fields
}
WorkerScheduleProbe coordinates worker scheduling tests.
func NewWorkerScheduleProbe ¶
func NewWorkerScheduleProbe(limit int32, total int) *WorkerScheduleProbe
NewWorkerScheduleProbe creates a probe for a concurrency limit and total schedule attempts.
func (*WorkerScheduleProbe) ReleaseAll ¶
func (p *WorkerScheduleProbe) ReleaseAll()
ReleaseAll unblocks all handlers currently held by the probe.
func (*WorkerScheduleProbe) RequireLimitReached ¶
func (p *WorkerScheduleProbe) RequireLimitReached(t *testing.T)
RequireLimitReached waits for the configured concurrency limit and verifies the peak.
func (*WorkerScheduleProbe) RequireNeverExceeded ¶
func (p *WorkerScheduleProbe) RequireNeverExceeded(t *testing.T)
RequireNeverExceeded verifies the worker never exceeded its configured limit.
func (*WorkerScheduleProbe) RequireScheduled ¶
func (p *WorkerScheduleProbe) RequireScheduled(t *testing.T)
RequireScheduled verifies every schedule attempt returned nil.