ratelimit

package
v3.2.7+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2021 License: Apache-2.0, MIT Imports: 3 Imported by: 1

Documentation

Overview

Copyright 2019 The Vearch Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketRateLimit

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

func (*BucketRateLimit) Wait

func (r *BucketRateLimit) Wait(n int64) bool

type ConcurrentLimit

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

func NewConcurrentLimit

func NewConcurrentLimit(c int, timeout time.Duration) *ConcurrentLimit

func (*ConcurrentLimit) Close

func (c *ConcurrentLimit) Close()

func (*ConcurrentLimit) GetToken

func (c *ConcurrentLimit) GetToken() bool

func (*ConcurrentLimit) PutToken

func (c *ConcurrentLimit) PutToken()

type NullRateLimit

type NullRateLimit struct{}

func (*NullRateLimit) Wait

func (r *NullRateLimit) Wait(n int64) bool

type RateLimit

type RateLimit interface {
	Wait(int64) bool
}

func NewBucketRateLimit

func NewBucketRateLimit(rate int, capacity int64, waitTimeout time.Duration) RateLimit

func NewNullRateLimit

func NewNullRateLimit() RateLimit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL