Documentation ¶
Index ¶
- type APILockConfig
- type APILockInboundMiddleware
- func (m *APILockInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, ...) error
- func (m *APILockInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
- func (m *APILockInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
- func (l APILockInboundMiddleware) LockRead()
- func (l APILockInboundMiddleware) LockWrite()
- func (l APILockInboundMiddleware) UnlockRead()
- func (l APILockInboundMiddleware) UnlockWrite()
- type APILockInterface
- type AuthInboundMiddleware
- func (m *AuthInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, ...) error
- func (m *AuthInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
- func (m *AuthInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
- type LeaderCheckInboundMiddleware
- func (m *LeaderCheckInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, ...) error
- func (m *LeaderCheckInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
- func (m *LeaderCheckInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
- func (m *LeaderCheckInboundMiddleware) SetNomination(nomination leader.Nomination)
- type RateLimitConfig
- type RateLimitInboundMiddleware
- func (m *RateLimitInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, ...) error
- func (m *RateLimitInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
- func (m *RateLimitInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
- type TokenBucket
- type YAPRCMetricsInboundMiddleware
- func (m *YAPRCMetricsInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, ...) error
- func (m *YAPRCMetricsInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
- func (m *YAPRCMetricsInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APILockConfig ¶
type APILockConfig struct { ReadAPIs []string `yaml:"read_apis"` WriteAPIs []string `yaml:"write_apis"` }
APILockConfig specifies which APIs are Read/Write
type APILockInboundMiddleware ¶
type APILockInboundMiddleware struct {
// contains filtered or unexported fields
}
APILockInboundMiddleware implements Read/Write lock on API
func NewAPILockInboundMiddleware ¶
func NewAPILockInboundMiddleware(config *APILockConfig) *APILockInboundMiddleware
NewAPILockInboundMiddleware creates new APILockInboundMiddleware
func (*APILockInboundMiddleware) Handle ¶
func (m *APILockInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
Handle checks if a request is blocked due to lock down and invokes the underlying handler
func (*APILockInboundMiddleware) HandleOneway ¶
func (m *APILockInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
HandleOneway checks if a request is blocked due to lock down and invokes the underlying handler
func (*APILockInboundMiddleware) HandleStream ¶
func (m *APILockInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
HandleStream checks if a request is blocked due to lock down and invokes the underlying handler
func (APILockInboundMiddleware) UnlockRead ¶
func (l APILockInboundMiddleware) UnlockRead()
func (APILockInboundMiddleware) UnlockWrite ¶
func (l APILockInboundMiddleware) UnlockWrite()
type APILockInterface ¶
type APILockInterface interface { // Lock read APIs LockRead() // Lock write APIs LockWrite() // Unlock read APIs UnlockRead() // Unlock write APIs UnlockWrite() }
APILockInterface enables users to lock a specific set of APIs
type AuthInboundMiddleware ¶
type AuthInboundMiddleware struct {
auth.SecurityManager
}
AuthInboundMiddleware is the inbound middleware for auth
func NewAuthInboundMiddleware ¶
func NewAuthInboundMiddleware(security auth.SecurityManager) *AuthInboundMiddleware
NewAuthInboundMiddleware returns AuthInboundMiddleware with auth check
func (*AuthInboundMiddleware) Handle ¶
func (m *AuthInboundMiddleware) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
Handle authenticates user and invokes the underlying handler
func (*AuthInboundMiddleware) HandleOneway ¶
func (m *AuthInboundMiddleware) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
HandleOneway authenticates user and invokes the underlying handler
func (*AuthInboundMiddleware) HandleStream ¶
func (m *AuthInboundMiddleware) HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
HandleStream authenticates user and invokes the underlying handler
type LeaderCheckInboundMiddleware ¶
type LeaderCheckInboundMiddleware struct {
Nomination leader.Nomination
}
LeaderCheckInboundMiddleware validates inbound request are only served via leader
func (*LeaderCheckInboundMiddleware) Handle ¶
func (m *LeaderCheckInboundMiddleware) Handle( ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler, ) error
Handle checks error returned by underlying handler and collect metrics
func (*LeaderCheckInboundMiddleware) HandleOneway ¶
func (m *LeaderCheckInboundMiddleware) HandleOneway( ctx context.Context, req *transport.Request, h transport.OnewayHandler, ) error
HandleOneway checks error returned by underlying handler and collect metrics
func (*LeaderCheckInboundMiddleware) HandleStream ¶
func (m *LeaderCheckInboundMiddleware) HandleStream( s *transport.ServerStream, h transport.StreamHandler, ) error
HandleStream checks error returned by underlying handler and collect metrics
func (*LeaderCheckInboundMiddleware) SetNomination ¶
func (m *LeaderCheckInboundMiddleware) SetNomination(nomination leader.Nomination)
SetNomination sets the nominator for checking the leadership of the node
type RateLimitConfig ¶
type RateLimitConfig struct { Enabled bool // Methods is evaluated from top to down, and the first matched // config is applied Methods []struct { Name string TokenBucket `yaml:",inline"` } // Default is the default rate limit config, // if the method called is not defined in Methods field. // If not set, there is no rate limit. Default *TokenBucket `yaml:",omitempty"` }
type RateLimitInboundMiddleware ¶
type RateLimitInboundMiddleware struct {
// contains filtered or unexported fields
}
func NewRateLimitInboundMiddleware ¶
func NewRateLimitInboundMiddleware(config RateLimitConfig) (*RateLimitInboundMiddleware, error)
func (*RateLimitInboundMiddleware) Handle ¶
func (m *RateLimitInboundMiddleware) Handle( ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler, ) error
Handle checks rate limit quota and invokes underlying handler
func (*RateLimitInboundMiddleware) HandleOneway ¶
func (m *RateLimitInboundMiddleware) HandleOneway( ctx context.Context, req *transport.Request, h transport.OnewayHandler, ) error
HandleOneway checks rate limit quota and invokes underlying handler
func (*RateLimitInboundMiddleware) HandleStream ¶
func (m *RateLimitInboundMiddleware) HandleStream( s *transport.ServerStream, h transport.StreamHandler, ) error
HandleStream checks rate limit quota and invokes underlying handler
type TokenBucket ¶
type YAPRCMetricsInboundMiddleware ¶
YAPRCMetricsInboundMiddleware collects yarpc related metrics, such as error code
func (*YAPRCMetricsInboundMiddleware) Handle ¶
func (m *YAPRCMetricsInboundMiddleware) Handle( ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler, ) error
Handle checks error returned by underlying handler and collect metrics
func (*YAPRCMetricsInboundMiddleware) HandleOneway ¶
func (m *YAPRCMetricsInboundMiddleware) HandleOneway( ctx context.Context, req *transport.Request, h transport.OnewayHandler, ) error
HandleOneway checks error returned by underlying handler and collect metrics
func (*YAPRCMetricsInboundMiddleware) HandleStream ¶
func (m *YAPRCMetricsInboundMiddleware) HandleStream( s *transport.ServerStream, h transport.StreamHandler, ) error
HandleStream checks error returned by underlying handler and collect metrics