Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Count int
Functions ¶
func BuildInterceptorChain ¶
func BuildInterceptorChain(invoker protocol.Invoker, builtins ...Interceptor) protocol.Invoker
func SetClusterInterceptor ¶
func SetClusterInterceptor(name string, fun func() Interceptor)
SetClusterInterceptor sets cluster interceptor so that user has chance to inject extra logics before and after cluster invoker
Types ¶
type Cluster ¶
func NewMockCluster ¶
func NewMockCluster() Cluster
NewMockCluster returns a mock cluster instance.
Mock cluster is usually used for service degradation, such as an authentication service. When the service provider is completely hung up, the client does not throw an exception, return an authorization failure through the Mock data instead.
type Interceptor ¶
type Interceptor interface { // Invoke is the core function of a cluster interceptor, it determines the process of the interceptor Invoke(context.Context, protocol.Invoker, protocol.Invocation) protocol.Result }
func GetClusterInterceptor ¶
func GetClusterInterceptor(name string) Interceptor
GetClusterInterceptor returns the cluster interceptor instance with the given name
func GetClusterInterceptors ¶
func GetClusterInterceptors() []Interceptor
GetClusterInterceptors returns all instances of registered cluster interceptors
type InterceptorInvoker ¶
type InterceptorInvoker struct {
// contains filtered or unexported fields
}
InterceptorInvoker mocks cluster interceptor as an invoker
func (*InterceptorInvoker) Destroy ¶
func (i *InterceptorInvoker) Destroy()
Destroy will destroy invoker
func (*InterceptorInvoker) GetURL ¶
func (i *InterceptorInvoker) GetURL() *common.URL
GetURL is used to get url from InterceptorInvoker
func (*InterceptorInvoker) Invoke ¶
func (i *InterceptorInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result
Invoke is used to call service method by invocation
func (*InterceptorInvoker) IsAvailable ¶
func (i *InterceptorInvoker) IsAvailable() bool
IsAvailable is used to get available status
type MockInvoker ¶
type MockInvoker struct {
// contains filtered or unexported fields
}
func NewMockInvoker ¶
func NewMockInvoker(url *common.URL, successCount int) *MockInvoker
func (*MockInvoker) Destroy ¶
func (bi *MockInvoker) Destroy()
func (*MockInvoker) GetURL ¶
func (bi *MockInvoker) GetURL() *common.URL
func (*MockInvoker) Invoke ¶
func (bi *MockInvoker) Invoke(c context.Context, invocation protocol.Invocation) protocol.Result
func (*MockInvoker) IsAvailable ¶
func (bi *MockInvoker) IsAvailable() bool
func (*MockInvoker) IsDestroyed ¶
func (bi *MockInvoker) IsDestroyed() bool
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package adaptivesvc implements adaptive service cluster strategy.
|
Package adaptivesvc implements adaptive service cluster strategy. |
Package available implements Available cluster strategy.
|
Package available implements Available cluster strategy. |
Package base implements invoker for the manipulation of cluster strategy.
|
Package base implements invoker for the manipulation of cluster strategy. |
Package broadcast implements Broadcast cluster strategy.
|
Package broadcast implements Broadcast cluster strategy. |
Package failback implements Failback cluster strategy.
|
Package failback implements Failback cluster strategy. |
Package failfast implements Failfast cluster strategy.
|
Package failfast implements Failfast cluster strategy. |
Package failover implements Failover cluster strategy.
|
Package failover implements Failover cluster strategy. |
Package failsafe implements Failsafe cluster strategy.
|
Package failsafe implements Failsafe cluster strategy. |
Package forking implements forking cluster strategy.
|
Package forking implements forking cluster strategy. |
Package zoneaware implements zoneaware cluster strategy.
|
Package zoneaware implements zoneaware cluster strategy. |