rkgrpctimeout

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rkgrpctimeout is a middleware of grpc framework for timing out request.

Index

Constants

View Source
const (
	TokenBucket   = "tokenBucket"
	LeakyBucket   = "leakyBucket"
	DefaultLimit  = 1000000
	GlobalLimiter = "rk-limiter"
)

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor

StreamServerInterceptor Add rate limit interceptors.

func UnaryServerInterceptor

func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor

UnaryServerInterceptor Add rate limit interceptors.

Types

type Option

type Option func(*optionSet)

Option option for optionSet

func WithEntryNameAndType

func WithEntryNameAndType(entryName, entryType string) Option

WithEntryNameAndType Provide entry name and entry type.

func WithTimeoutAndResp

func WithTimeoutAndResp(timeout time.Duration, resp error) Option

WithTimeoutAndResp Provide global timeout and response handler. If response is nil, default globalResponse will be assigned

func WithTimeoutAndRespByPath

func WithTimeoutAndRespByPath(path string, timeout time.Duration, resp error) Option

WithTimeoutAndRespByPath Provide timeout and response handler by path. If response is nil, default globalResponse will be assigned

Jump to

Keyboard shortcuts

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