Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRequestExceedsLimit = errors.New("dynsemaphore: request exceeds limit")
ErrRequestExceedsLimit is returned when a request exceeds the current limit.
Functions ¶
This section is empty.
Types ¶
type DynamicWeighted ¶
type DynamicWeighted struct {
// contains filtered or unexported fields
}
DynamicWeighted matches semaphore.Weighted API exactly, except the maximum size is provided dynamically.
func NewDynamicWeighted ¶
func NewDynamicWeighted(limitFn func() int64) *DynamicWeighted
func NewDynamicWeightedWithParent ¶
func NewDynamicWeightedWithParent(parent *DynamicWeighted, limitFn func() int64) *DynamicWeighted
func (*DynamicWeighted) Acquire ¶
func (s *DynamicWeighted) Acquire(ctx context.Context, n int64) error
func (*DynamicWeighted) Release ¶
func (s *DynamicWeighted) Release(n int64)
func (*DynamicWeighted) TryAcquire ¶
func (s *DynamicWeighted) TryAcquire(n int64) bool
Click to show internal directories.
Click to hide internal directories.