Discover Packages
github.com/Azure/adx-mon
pkg
limiter
package
Version:
v0.0.0-...-9228ce8
Opens a new window with list of versions in this module.
Published: Nov 26, 2024
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package limiter provides concurrency limiters.
LimitListener returns a Listener that accepts at most n simultaneous
connections from the provided Listener and will drop extra connections.
Fixed is a simple channel-based concurrency limiter. It uses a fixed
size channel to limit callers from proceeding until there is a value available
in the channel. If all are in-use, the caller blocks until one is freed.
Available returns the number of available tokens that may be taken.
Capacity returns the number of tokens can be taken.
Idle returns true if the limiter has all its capacity is available.
Release releases a token back to the limiter.
Take attempts to take a token and blocks until one is available OR until the given context
is cancelled.
TryTake attempts to take a token and return true if successful, otherwise returns false.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.