pkg

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCustomRejectedExecutionHandler

func GetCustomRejectedExecutionHandler() filter.RejectedExecutionHandler

func GetDefaultValueRejectedExecutionHandlerSingleton

func GetDefaultValueRejectedExecutionHandlerSingleton() filter.RejectedExecutionHandler

*

  • the better way is designing the RejectedExecutionHandler as singleton.

Types

type DefaultValueRejectedExecutionHandler

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

*

  • The RejectedExecutionHandler is used by some components,
  • e.g, ExecuteLimitFilter, GracefulShutdownFilter, TpsLimitFilter.
  • When the requests are rejected, the RejectedExecutionHandler allows you to do something.
  • You can alert the developer, or redirect those requests to another providers. It depends on what you need. *
  • Let's assume that you need a RejectedExecutionHandler which will return some default result if the request was rejected.

func (*DefaultValueRejectedExecutionHandler) RejectedExecution

func (mh *DefaultValueRejectedExecutionHandler) RejectedExecution(url *common.URL, invocation protocol.Invocation) protocol.Result

type RandomTpsLimitStrategy

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

*

  • The RandomTpsLimitStrategy should not be singleton because different TpsLimiter will create many instances.
  • we won't want them affect each other.

func (RandomTpsLimitStrategy) IsAllowable

func (r RandomTpsLimitStrategy) IsAllowable() bool

type RandomTpsLimitStrategyCreator

type RandomTpsLimitStrategyCreator struct{}

func (*RandomTpsLimitStrategyCreator) Create

func (creator *RandomTpsLimitStrategyCreator) Create(rate int, interval int) filter.TpsLimitStrategy

type User

type User struct {
	ID   string
	Name string
	Age  int32
	Time time.Time
}

func (User) JavaClassName

func (u User) JavaClassName() string

type UserProvider

type UserProvider struct {
}

func (*UserProvider) GetUser

func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error)

func (*UserProvider) Reference added in v1.5.7

func (u *UserProvider) Reference() string

Jump to

Keyboard shortcuts

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