filter

package
v3.0.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 36

README

Filter

Getting Started

Recommended Way: import what you needs, see also dubbo-go/imports.

package demo

// use echo and generic filters
import _ "dubbo.apache.org/dubbo-go/v3/filter/echo"
import _ "dubbo.apache.org/dubbo-go/v3/filter/generic"

Legacy way: import all filters by one line.

package demo

import _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"

Contents

Documentation

Overview

Package filter defines the functions of a filter.

  • please register your implementation by invoking SetTpsLimitStrategy
  • "UserProvider":
  • registry: "hangzhouzk"
  • protocol : "dubbo"
  • interface : "com.ikurento.user.UserProvider"
  • ... # other configuration
  • tps.limiter: "method-service" # the name of limiter
  • tps.limit.strategy: "name of implementation" # service-level
  • methods:
  • - name: "GetUser"
  • tps.interval: 3000
  • tps.limit.strategy: "name of implementation" # method-level

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKeyPair

type AccessKeyPair struct {
	AccessKey    string `yaml:"accessKey"   json:"accessKey,omitempty" property:"accessKey"`
	SecretKey    string `yaml:"secretKey"   json:"secretKey,omitempty" property:"secretKey"`
	ConsumerSide string `yaml:"consumerSide"   json:"consumerSide,omitempty" property:"consumerSide"`
	ProviderSide string `yaml:"providerSide"   json:"providerSide,omitempty" property:"providerSide"`
	Creator      string `yaml:"creator"   json:"creator,omitempty" property:"creator"`
	Options      string `yaml:"options"   json:"options,omitempty" property:"options"`
}

AccessKeyPair stores the basic attributes for authentication.

type AccessKeyStorage

type AccessKeyStorage interface {
	GetAccessKeyPair(protocol.Invocation, *common.URL) *AccessKeyPair
}

AccessKeyStorage is the interface which supports us to store our AccessKeyPair or load AccessKeyPair from other storage, such as filesystem.

type Authenticator

type Authenticator interface {

	// Sign adds signature to the invocation
	Sign(protocol.Invocation, *common.URL) error

	// Authenticate verifies the signature of the request
	Authenticate(protocol.Invocation, *common.URL) error
}

Authenticator is the interface which defines how an Authenticator works. Custom Authenticator must be set by calling auth.SetAuthenticator before use.

type Filter

Filter is the interface which wraps Invoke and OnResponse method and defines the functions of a filter. Invoke method is the core function of a filter, it determines the process of the filter. OnResponse method updates the results from Invoke and then returns the modified results.

type RejectedExecutionHandler

type RejectedExecutionHandler interface {
	RejectedExecution(url *common.URL, invocation protocol.Invocation) protocol.Result
}

RejectedExecutionHandler is the interface which defines the handler to handle exceptions from invoking filters. If the invocation cannot pass any validation in filter, like ExecuteLimitFilter and TpsLimitFilter, the implementation will be used. The common case is that sometimes you want to return the default value when the request was rejected. Or you want to be warned if any request was rejected. In such situation, implement this interface and register it by invoking extension.SetRejectedExecutionHandler.

RejectedExecution method will be called if the invocation was rejected by some component.

type TpsLimitStrategy

type TpsLimitStrategy interface {
	IsAllowable() bool
}

TpsLimitStrategy is the interface which defines how to do the TPS limiting in method level.

IsAllowable will return true if this invocation is not over limitation.

type TpsLimitStrategyCreator

type TpsLimitStrategyCreator interface {
	// Create will create an instance of TpsLimitStrategy
	// It will be a little hard to understand this method.
	// The unit of interval is ms
	// for example, if the limit = 100, interval = 1000
	// which means that the limiter limitation is 100 times per 1000ms (100/1000ms)
	Create(limit int, interval int) TpsLimitStrategy
}

TpsLimitStrategyCreator is the interface which creates TpsLimitStrategy.

type TpsLimiter

type TpsLimiter interface {
	IsAllowable(*common.URL, protocol.Invocation) bool
}

TpsLimiter is the interface which defines the Limiter that judge if the TPS overs the threshold

IsAllowable method will check whether this invocation should be enabled for further process

please register your implementation by invoking SetTpsLimiter The usage, for example: "UserProvider":

registry: "hangzhouzk"
protocol : "dubbo"
interface : "com.ikurento.user.UserProvider"
... # other configuration
tps.limiter: "the name of limiter",

Directories

Path Synopsis
Package accesslog providers logging filter.
Package accesslog providers logging filter.
Package adaptivesvc providers AdaptiveService filter.
Package adaptivesvc providers AdaptiveService filter.
Package auth providers authorization filter.
Package auth providers authorization filter.
Package echo providers health check filter.
Package echo providers health check filter.
Package exec_limit provides a filter for limiting the number of in-progress request and it's thread-safe.
Package exec_limit provides a filter for limiting the number of in-progress request and it's thread-safe.
Package filter_impl is for being compatible with older dubbo-go, please use `imports` package.
Package filter_impl is for being compatible with older dubbo-go, please use `imports` package.
Package generic provides generic invoke filter.
Package generic provides generic invoke filter.
Package graceful_shutdown provides a filter for shutting down gracefully.
Package graceful_shutdown provides a filter for shutting down gracefully.
Package filter is a generated GoMock package.
Package filter is a generated GoMock package.
Package hystrix provides hystrix filter.
Package hystrix provides hystrix filter.
Package metrics provides metrics collection filter.
Package metrics provides metrics collection filter.
otel
trace
Package trace instruments dubbogo with open-telemetry (https://github.com/open-telemetry/opentelemetry-go).
Package trace instruments dubbogo with open-telemetry (https://github.com/open-telemetry/opentelemetry-go).
polaris
Package seata provides a filter when use seata-golang, use this filter to transfer xid.
Package seata provides a filter when use seata-golang, use this filter to transfer xid.
Package sentinel provides a filter when using sentinel.
Package sentinel provides a filter when using sentinel.
Package token provides token filter.
Package token provides token filter.
tps
Package tps provides a filter for limiting the requests by TPS.
Package tps provides a filter for limiting the requests by TPS.
limiter
Package filter is a generated GoMock package.
Package filter is a generated GoMock package.
strategy
Package filter is a generated GoMock package.
Package filter is a generated GoMock package.
Package tracing provides tracing collection filter.
Package tracing provides tracing collection filter.
xds
cb

Jump to

Keyboard shortcuts

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