Versions in this module Expand all Collapse all v3 v3.0.2 Nov 14, 2023 v3.0.1 Feb 4, 2023 v3.0.0 Jan 5, 2023 Changes in this version + var ErrClosed = errors.New("mb: MB closed") + var ErrOverflowed = errors.New("mb: overflowed") + var ErrTooManyMessages = errors.New("mb: too many messages") + func CtxWithTimeLimit(ctx context.Context, timeLimit time.Duration) context.Context + type MB struct + func New(size int) *MB[T] + func (mb *MB[T]) Add(ctx context.Context, msgs ...T) (err error) + func (mb *MB[T]) Close() (err error) + func (mb *MB[T]) GetAll() (msgs []T) + func (mb *MB[T]) Len() (l int) + func (mb *MB[T]) NewCond() WaitCond[T] + func (mb *MB[T]) Pause() + func (mb *MB[T]) Resume() + func (mb *MB[T]) Stats() (addCount, addMsgsCount, getCount, getMsgsCount int64) + func (mb *MB[T]) TryAdd(msgs ...T) (err error) + func (mb *MB[T]) Wait(ctx context.Context) (msgs []T, err error) + func (mb *MB[T]) WaitCond(ctx context.Context, cond WaitCond[T]) (msgs []T, err error) + func (mb *MB[T]) WaitOne(ctx context.Context) (msg T, err error) + type WaitCond struct + Filter func(v T) bool + Max int + Min int + Priority float64 + func (wc WaitCond[T]) Wait(ctx context.Context) (msgs []T, err error) + func (wc WaitCond[T]) WaitOne(ctx context.Context) (msg T, err error) + func (wc WaitCond[T]) WithFilter(f func(v T) bool) WaitCond[T] + func (wc WaitCond[T]) WithMax(max int) WaitCond[T] + func (wc WaitCond[T]) WithMin(min int) WaitCond[T] + func (wc WaitCond[T]) WithPriority(priority float64) WaitCond[T] Other modules containing this package github.com/cheggaaa/mb github.com/cheggaaa/mb/v2