Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConcurrencyLimiterTimeout = errors.New("reaches the max concurrency for writing")
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
func NewLimiter ¶
func NewLimiter(ctx context.Context, maxConcurrency int, timeout time.Duration, statistics *metrics.LimitStatistics) *Limiter
NewLimiter creates a limiter based of buffer channel. It limits the concurrency for writing.
type Pool ¶
type Pool interface { // Submit enqueues a callable task for a worker to execute. // // Each submitted task is immediately given to a ready worker. // If there are no available workers, the dispatcher starts a new worker, // until the maximum number of workers are added. // // After the maximum number of workers are running, and no workers are ready, // execute function will be blocked. Submit(ctx context.Context, task *Task) // Stopped returns true if this pool has been stopped. Stopped() bool // Stop stops all goroutines gracefully, // all pending tasks will be finished before exit Stop() }
Pool represents the goroutine pool that executes submitted tasks.
Click to show internal directories.
Click to hide internal directories.