cockroach: github.com/cockroachdb/cockroach/pkg/util/limit Index | Files

package limit

import "github.com/cockroachdb/cockroach/pkg/util/limit"

Index

Package Files

limiter.go

type ConcurrentRequestLimiter Uses

type ConcurrentRequestLimiter struct {
    // contains filtered or unexported fields
}

ConcurrentRequestLimiter wraps a simple semaphore, adding a tracing span when a request is forced to wait.

func MakeConcurrentRequestLimiter Uses

func MakeConcurrentRequestLimiter(spanName string, limit int) ConcurrentRequestLimiter

MakeConcurrentRequestLimiter creates a ConcurrentRequestLimiter.

func (*ConcurrentRequestLimiter) Begin Uses

func (l *ConcurrentRequestLimiter) Begin(ctx context.Context) error

Begin attempts to reserve a spot in the pool, blocking if needed until the one is available or the context is canceled and adding a tracing span if it is forced to block.

func (*ConcurrentRequestLimiter) Finish Uses

func (l *ConcurrentRequestLimiter) Finish()

Finish indicates a concurrent request has completed and its reservation can be returned to the pool.

func (*ConcurrentRequestLimiter) SetLimit Uses

func (l *ConcurrentRequestLimiter) SetLimit(newLimit int)

SetLimit adjusts the size of the pool.

Package limit imports 3 packages (graph) and is imported by 2 packages. Updated 2019-07-06. Refresh now. Tools for package owners.