Documentation ¶
Index ¶
- Variables
- func DefaultAsyncCloseNamespace(ns Namespace) error
- type Backend
- type Breaker
- type BreakerManager
- func (this *BreakerManager) AddTimeWheelTask(name string, connectionID uint64, flag *int32) error
- func (this *BreakerManager) CASHalfOpenProbeSent(name string, idx int, halfOpenProbeSent bool) bool
- func (this *BreakerManager) CloseBreaker()
- func (this *BreakerManager) GetBreakerScope() string
- func (this *BreakerManager) Hit(name string, idx int, isFail bool) error
- func (this *BreakerManager) IsUseBreaker() bool
- func (this *BreakerManager) RemoveTimeWheelTask(connectionID uint64) error
- func (this *BreakerManager) Status(name string) (int32, int)
- type Frontend
- type FrontendNamespace
- func (n *FrontendNamespace) Auth(username string, passwdBytes []byte, salt []byte) bool
- func (n *FrontendNamespace) IsAllowedSQL(sqlFeature uint32) bool
- func (n *FrontendNamespace) IsDatabaseAllowed(db string) bool
- func (n *FrontendNamespace) IsDeniedSQL(sqlFeature uint32) bool
- func (n *FrontendNamespace) ListDatabases() []string
- type Namespace
- type NamespaceBuilder
- type NamespaceCloser
- type NamespaceHolder
- type NamespaceImpl
- type NamespaceManager
- func (n *NamespaceManager) Auth(username string, pwd, salt []byte) (driver.Namespace, bool)
- func (n *NamespaceManager) CommitReloadNamespaces(namespaces []string) error
- func (n *NamespaceManager) PrepareReloadNamespace(namespace string, cfg *config.Namespace) error
- func (n *NamespaceManager) RemoveNamespace(name string)
- type NamespaceRateLimiter
- type NamespaceWrapper
- func (n *NamespaceWrapper) Closed() bool
- func (n *NamespaceWrapper) DescConnCount()
- func (n *NamespaceWrapper) GetBreaker() (driver.Breaker, error)
- func (n *NamespaceWrapper) GetPooledConn(ctx context.Context) (driver.PooledBackendConn, error)
- func (n *NamespaceWrapper) GetRateLimiter() driver.RateLimiter
- func (n *NamespaceWrapper) IncrConnCount()
- func (n *NamespaceWrapper) IsAllowedSQL(sqlFeature uint32) bool
- func (n *NamespaceWrapper) IsDatabaseAllowed(db string) bool
- func (n *NamespaceWrapper) IsDeniedSQL(sqlFeature uint32) bool
- func (n *NamespaceWrapper) ListDatabases() []string
- func (n *NamespaceWrapper) Name() string
- type SQLInfo
- type StrategySlice
- type UserNamespaceMapper
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicatedUser = errors.New("duplicated user") ErrInvalidSelectorType = errors.New("invalid selector type") ErrNilBreakerName = errors.New("breaker name nil") ErrInvalidFailureRateThreshold = errors.New("invalid FailureRateThreshold") ErrInvalidopenStatusDurationMs = errors.New("invalid OpenStatusDurationMs") ErrInvalidSqlTimeout = errors.New("invalid sql timeout") ErrInvalidScope = errors.New("invalid scope") )
Functions ¶
Types ¶
type Backend ¶
type Backend interface { Close() GetPooledConn(context.Context) (driver.PooledBackendConn, error) }
func BuildBackend ¶
func BuildBackend(ns string, cfg *config.BackendNamespace) (Backend, error)
type Breaker ¶
type Breaker struct {
// contains filtered or unexported fields
}
func NewBreaker ¶
func NewBreaker(br *config.BreakerInfo) (*Breaker, error)
type BreakerManager ¶
type BreakerManager struct {
// contains filtered or unexported fields
}
func NewBreakerManager ¶
func NewBreakerManager(br *config.BreakerInfo) (*BreakerManager, error)
func (*BreakerManager) AddTimeWheelTask ¶
func (this *BreakerManager) AddTimeWheelTask(name string, connectionID uint64, flag *int32) error
func (*BreakerManager) CASHalfOpenProbeSent ¶
func (this *BreakerManager) CASHalfOpenProbeSent(name string, idx int, halfOpenProbeSent bool) bool
func (*BreakerManager) CloseBreaker ¶
func (this *BreakerManager) CloseBreaker()
func (*BreakerManager) GetBreakerScope ¶
func (this *BreakerManager) GetBreakerScope() string
func (*BreakerManager) Hit ¶
func (this *BreakerManager) Hit(name string, idx int, isFail bool) error
func (*BreakerManager) IsUseBreaker ¶
func (this *BreakerManager) IsUseBreaker() bool
func (*BreakerManager) RemoveTimeWheelTask ¶
func (this *BreakerManager) RemoveTimeWheelTask(connectionID uint64) error
type Frontend ¶
type Frontend interface { Auth(username string, passwdBytes []byte, salt []byte) bool IsDatabaseAllowed(db string) bool ListDatabases() []string IsDeniedSQL(sqlFeature uint32) bool IsAllowedSQL(sqlFeature uint32) bool }
func BuildFrontend ¶
func BuildFrontend(cfg *config.FrontendNamespace) (Frontend, error)
type FrontendNamespace ¶
type FrontendNamespace struct {
// contains filtered or unexported fields
}
func (*FrontendNamespace) Auth ¶
func (n *FrontendNamespace) Auth(username string, passwdBytes []byte, salt []byte) bool
func (*FrontendNamespace) IsAllowedSQL ¶
func (n *FrontendNamespace) IsAllowedSQL(sqlFeature uint32) bool
func (*FrontendNamespace) IsDatabaseAllowed ¶
func (n *FrontendNamespace) IsDatabaseAllowed(db string) bool
func (*FrontendNamespace) IsDeniedSQL ¶
func (n *FrontendNamespace) IsDeniedSQL(sqlFeature uint32) bool
func (*FrontendNamespace) ListDatabases ¶
func (n *FrontendNamespace) ListDatabases() []string
type Namespace ¶
type Namespace interface { Name() string Auth(username string, passwdBytes []byte, salt []byte) bool IsDatabaseAllowed(db string) bool ListDatabases() []string IsDeniedSQL(sqlFeature uint32) bool IsAllowedSQL(sqlFeature uint32) bool GetPooledConn(context.Context) (driver.PooledBackendConn, error) Close() GetBreaker() (driver.Breaker, error) GetRateLimiter() driver.RateLimiter }
type NamespaceCloser ¶
type NamespaceHolder ¶
type NamespaceHolder struct {
// contains filtered or unexported fields
}
func CreateNamespaceHolder ¶
func CreateNamespaceHolder(cfgs []*config.Namespace, build NamespaceBuilder) (*NamespaceHolder, error)
func (*NamespaceHolder) Clone ¶
func (n *NamespaceHolder) Clone() *NamespaceHolder
func (*NamespaceHolder) Delete ¶
func (n *NamespaceHolder) Delete(name string)
func (*NamespaceHolder) Set ¶
func (n *NamespaceHolder) Set(name string, ns Namespace)
type NamespaceImpl ¶
type NamespaceImpl struct { Br driver.Breaker Backend Frontend // contains filtered or unexported fields }
func (*NamespaceImpl) GetBreaker ¶
func (n *NamespaceImpl) GetBreaker() (driver.Breaker, error)
func (*NamespaceImpl) GetRateLimiter ¶
func (n *NamespaceImpl) GetRateLimiter() driver.RateLimiter
func (*NamespaceImpl) Name ¶
func (n *NamespaceImpl) Name() string
type NamespaceManager ¶
type NamespaceManager struct {
// contains filtered or unexported fields
}
func CreateNamespaceManager ¶
func CreateNamespaceManager(cfgs []*config.Namespace, builder NamespaceBuilder, closer NamespaceCloser) (*NamespaceManager, error)
func NewNamespaceManager ¶
func NewNamespaceManager(users *UserNamespaceMapper, nss *NamespaceHolder, builder NamespaceBuilder, closer NamespaceCloser) *NamespaceManager
func (*NamespaceManager) CommitReloadNamespaces ¶
func (n *NamespaceManager) CommitReloadNamespaces(namespaces []string) error
func (*NamespaceManager) PrepareReloadNamespace ¶
func (n *NamespaceManager) PrepareReloadNamespace(namespace string, cfg *config.Namespace) error
func (*NamespaceManager) RemoveNamespace ¶
func (n *NamespaceManager) RemoveNamespace(name string)
type NamespaceRateLimiter ¶
type NamespaceRateLimiter struct {
// contains filtered or unexported fields
}
func NewNamespaceRateLimiter ¶
func NewNamespaceRateLimiter(scope string, qpsThreshold int) *NamespaceRateLimiter
func (*NamespaceRateLimiter) Limit ¶
func (n *NamespaceRateLimiter) Limit(ctx context.Context, key string) error
func (*NamespaceRateLimiter) Scope ¶
func (n *NamespaceRateLimiter) Scope() string
type NamespaceWrapper ¶
type NamespaceWrapper struct {
// contains filtered or unexported fields
}
func (*NamespaceWrapper) Closed ¶
func (n *NamespaceWrapper) Closed() bool
func (*NamespaceWrapper) DescConnCount ¶
func (n *NamespaceWrapper) DescConnCount()
func (*NamespaceWrapper) GetBreaker ¶
func (n *NamespaceWrapper) GetBreaker() (driver.Breaker, error)
func (*NamespaceWrapper) GetPooledConn ¶
func (n *NamespaceWrapper) GetPooledConn(ctx context.Context) (driver.PooledBackendConn, error)
func (*NamespaceWrapper) GetRateLimiter ¶
func (n *NamespaceWrapper) GetRateLimiter() driver.RateLimiter
func (*NamespaceWrapper) IncrConnCount ¶
func (n *NamespaceWrapper) IncrConnCount()
func (*NamespaceWrapper) IsAllowedSQL ¶
func (n *NamespaceWrapper) IsAllowedSQL(sqlFeature uint32) bool
func (*NamespaceWrapper) IsDatabaseAllowed ¶
func (n *NamespaceWrapper) IsDatabaseAllowed(db string) bool
func (*NamespaceWrapper) IsDeniedSQL ¶
func (n *NamespaceWrapper) IsDeniedSQL(sqlFeature uint32) bool
func (*NamespaceWrapper) ListDatabases ¶
func (n *NamespaceWrapper) ListDatabases() []string
func (*NamespaceWrapper) Name ¶
func (n *NamespaceWrapper) Name() string
type StrategySlice ¶
type StrategySlice []config.StrategyInfo
func (StrategySlice) Len ¶
func (a StrategySlice) Len() int
func (StrategySlice) Less ¶
func (a StrategySlice) Less(i, j int) bool
func (StrategySlice) Swap ¶
func (a StrategySlice) Swap(i, j int)
type UserNamespaceMapper ¶
type UserNamespaceMapper struct {
// contains filtered or unexported fields
}
func CreateUserNamespaceMapper ¶
func CreateUserNamespaceMapper(namespaces []*config.Namespace) (*UserNamespaceMapper, error)
func (*UserNamespaceMapper) AddNamespaceUsers ¶
func (u *UserNamespaceMapper) AddNamespaceUsers(ns string, cfg *config.FrontendNamespace) error
func (*UserNamespaceMapper) Clone ¶
func (u *UserNamespaceMapper) Clone() *UserNamespaceMapper
func (*UserNamespaceMapper) GetUserNamespace ¶
func (u *UserNamespaceMapper) GetUserNamespace(username string) (string, bool)
func (*UserNamespaceMapper) RemoveNamespaceUsers ¶
func (u *UserNamespaceMapper) RemoveNamespaceUsers(ns string)
Click to show internal directories.
Click to hide internal directories.