Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTooMuchWaiting = status.Error(grpccodes.ResourceExhausted, "rejecting request, too much pending data") ErrRequestTooLarge = status.Errorf(grpccodes.InvalidArgument, "rejecting request, request is too large") )
Functions ¶
This section is empty.
Types ¶
type BoundedQueue ¶
type BoundedQueue struct {
// contains filtered or unexported fields
}
BoundedQueue is a LIFO-oriented admission-controlled Queue.
func (*BoundedQueue) Acquire ¶
func (bq *BoundedQueue) Acquire(ctx context.Context, pending uint64) (ReleaseFunc, error)
Acquire implements Queue.
type N ¶
type N struct {
// contains filtered or unexported fields
}
notification.N is a minimal Go version of absl::Notification:
https://github.com/abseil/abseil-cpp/blob/master/absl/synchronization/notification.h
Use New() to construct a notification object (the zero value is not usable).
func (*N) Chan ¶
func (n *N) Chan() <-chan struct{}
Chan allows a caller to wait for the notification as part of a select statement. Outside of a select statement, prefer writing WaitForNotification().
func (*N) HasBeenNotified ¶
func (*N) WaitForNotification ¶
func (n *N) WaitForNotification()
type Queue ¶
type Queue interface { // Acquire asks the controller to admit the caller. // // The weight parameter specifies how large of an admission to make. // This might be used on the bytes of request (for example) to differentiate // between large and small requests. // // Admit will return when one of the following events occurs: // // (1) admission is allowed, or // (2) the provided ctx becomes canceled, or // (3) there are so many existing waiters that the // controller decides to reject this caller without // admitting it. // // In case (1), the return value will be a non-nil // ReleaseFunc. The caller must invoke it after it is finished // with the resource being guarded by the admission // controller. // // In case (2), the return value will be a Cancelled or // DeadlineExceeded error. // // In case (3), the return value will be a ResourceExhausted // error. Acquire(ctx context.Context, weight uint64) (ReleaseFunc, error) }
Queue is a weighted admission queue interface.
func NewBoundedQueue ¶
func NewBoundedQueue(id component.ID, ts component.TelemetrySettings, maxLimitAdmit, maxLimitWait uint64) (Queue, error)
NewBoundedQueue returns a LIFO-oriented Queue implementation which admits `maxLimitAdmit` bytes concurrently and allows up to `maxLimitWait` bytes to wait for admission.
func NewUnboundedQueue ¶
func NewUnboundedQueue() Queue
NewUnboundedQueue returns a no-op implementation of the Queue interface.
type ReleaseFunc ¶
type ReleaseFunc func()
ReleaseFunc is returned by Acquire when the Acquire() was admitted.