Documentation ¶
Overview ¶
Package gate provides building blocks to limit concurrency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
type Gate struct {
// contains filtered or unexported fields
}
Gate provides concurrency limitation.
func (*Gate) Reserve ¶
func (g *Gate) Reserve() (*Reservation, bool)
Reserve attempts to obtain a reservation. If the wait queue is too long, it returns false.
type Reservation ¶
type Reservation struct {
// contains filtered or unexported fields
}
Reservation represents a reservation.
func (*Reservation) Release ¶
func (r *Reservation) Release()
Release returns the reservation. It must be called when the reservation is no longer needed. It doesn't matter if Wait() was called or not.
func (*Reservation) Wait ¶
func (r *Reservation) Wait()
Wait blocks until number of inflight requests is lower than the maximum.
Click to show internal directories.
Click to hide internal directories.