Documentation
¶
Index ¶
- Variables
- func BeginCount(url *common.URL, methodName string)
- func CleanAllStatus()
- func CurrentTimeMillis() int64
- func EndCount(url *common.URL, methodName string, elapsed int64, succeeded bool)
- func GetAndRefreshState() bool
- func GetInvokerHealthyStatus(invoker Invoker) bool
- func RemoveInvokerUnhealthyStatus(invoker Invoker)
- func RemoveUrlKeyUnhealthyStatus(key string)
- func SetInvokerUnhealthyStatus(invoker Invoker)
- func TryRefreshBlackList()
- type AvailabilitySetter
- type BaseExporter
- type BaseInvoker
- func (bi *BaseInvoker) Destroy()
- func (bi *BaseInvoker) GetURL() *common.URL
- func (bi *BaseInvoker) Invoke(context context.Context, invocation Invocation) result.Result
- func (bi *BaseInvoker) IsAvailable() bool
- func (bi *BaseInvoker) IsDestroyed() bool
- func (bi *BaseInvoker) SetAvailable(available bool)
- func (bi *BaseInvoker) String() string
- type BaseProtocol
- func (bp *BaseProtocol) Destroy()
- func (bp *BaseProtocol) Export(invoker Invoker) Exporter
- func (bp *BaseProtocol) ExporterMap() *sync.Map
- func (bp *BaseProtocol) Invokers() []Invoker
- func (bp *BaseProtocol) Refer(url *common.URL) Invoker
- func (bp *BaseProtocol) SetExporterMap(key string, exporter Exporter)
- func (bp *BaseProtocol) SetInvokers(invoker Invoker)
- type Exporter
- type HTTPHandlerHost
- type Invocation
- type Invoker
- type Protocol
- type RPCStatus
- func (rpc *RPCStatus) GetActive() int32
- func (rpc *RPCStatus) GetFailed() int32
- func (rpc *RPCStatus) GetFailedElapsed() int64
- func (rpc *RPCStatus) GetFailedMaxElapsed() int64
- func (rpc *RPCStatus) GetLastRequestFailedTimestamp() int64
- func (rpc *RPCStatus) GetMaxElapsed() int64
- func (rpc *RPCStatus) GetSucceededMaxElapsed() int64
- func (rpc *RPCStatus) GetSuccessiveRequestFailureCount() int32
- func (rpc *RPCStatus) GetTotal() int32
- func (rpc *RPCStatus) GetTotalElapsed() int64
- type RegistryUnregisterer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetAndRefreshState ¶
func GetAndRefreshState() bool
func GetInvokerHealthyStatus ¶
GetInvokerHealthyStatus get invoker's conn healthy status
func RemoveInvokerUnhealthyStatus ¶
func RemoveInvokerUnhealthyStatus(invoker Invoker)
RemoveInvokerUnhealthyStatus remove unhealthy status of target invoker from blacklist
func RemoveUrlKeyUnhealthyStatus ¶
func RemoveUrlKeyUnhealthyStatus(key string)
RemoveUrlKeyUnhealthyStatus called when event of provider unregister, delete from black list
func SetInvokerUnhealthyStatus ¶
func SetInvokerUnhealthyStatus(invoker Invoker)
SetInvokerUnhealthyStatus add target invoker to black list
func TryRefreshBlackList ¶
func TryRefreshBlackList()
TryRefreshBlackList start 3 gr to check at most block=16 invokers in black list if target invoker is available, then remove it from black list
Types ¶
type AvailabilitySetter ¶ added in v3.3.2
type AvailabilitySetter interface {
SetAvailable(bool)
}
AvailabilitySetter is implemented by invokers that support toggling availability.
type BaseExporter ¶
type BaseExporter struct {
// contains filtered or unexported fields
}
BaseExporter is default exporter implement.
func NewBaseExporter ¶
func NewBaseExporter(key string, invoker Invoker, exporterMap *sync.Map) *BaseExporter
NewBaseExporter creates a new BaseExporter
func (*BaseExporter) GetInvoker ¶
func (de *BaseExporter) GetInvoker() Invoker
GetInvoker gets invoker
type BaseInvoker ¶
type BaseInvoker struct {
// contains filtered or unexported fields
}
BaseInvoker provides default invoker implements Invoker
func NewBaseInvoker ¶
func NewBaseInvoker(url *common.URL) *BaseInvoker
NewBaseInvoker creates a new BaseInvoker
func (*BaseInvoker) Destroy ¶
func (bi *BaseInvoker) Destroy()
Destroy changes available and destroyed flag and release the url's allocated memory
func (*BaseInvoker) GetURL ¶
func (bi *BaseInvoker) GetURL() *common.URL
GetURL gets base invoker URL
func (*BaseInvoker) Invoke ¶
func (bi *BaseInvoker) Invoke(context context.Context, invocation Invocation) result.Result
Invoke provides default invoker implement
func (*BaseInvoker) IsAvailable ¶
func (bi *BaseInvoker) IsAvailable() bool
IsAvailable gets available flag
func (*BaseInvoker) IsDestroyed ¶
func (bi *BaseInvoker) IsDestroyed() bool
IsDestroyed gets destroyed flag
func (*BaseInvoker) SetAvailable ¶ added in v3.3.2
func (bi *BaseInvoker) SetAvailable(available bool)
SetAvailable sets available flag
func (*BaseInvoker) String ¶
func (bi *BaseInvoker) String() string
type BaseProtocol ¶
type BaseProtocol struct {
// contains filtered or unexported fields
}
BaseProtocol is default protocol implement.
func NewBaseProtocol ¶
func NewBaseProtocol() BaseProtocol
NewBaseProtocol creates a new BaseProtocol
func (*BaseProtocol) Destroy ¶
func (bp *BaseProtocol) Destroy()
Destroy will destroy all invoker and exporter, so it only is called once.
func (*BaseProtocol) Export ¶
func (bp *BaseProtocol) Export(invoker Invoker) Exporter
Export is default export implement.
func (*BaseProtocol) ExporterMap ¶
func (bp *BaseProtocol) ExporterMap() *sync.Map
ExporterMap gets exporter map.
func (*BaseProtocol) Invokers ¶
func (bp *BaseProtocol) Invokers() []Invoker
Invokers gets a snapshot of all invokers.
func (*BaseProtocol) Refer ¶
func (bp *BaseProtocol) Refer(url *common.URL) Invoker
Refer is default refer implement.
func (*BaseProtocol) SetExporterMap ¶
func (bp *BaseProtocol) SetExporterMap(key string, exporter Exporter)
SetExporterMap set @exporter with @key to local memory.
func (*BaseProtocol) SetInvokers ¶
func (bp *BaseProtocol) SetInvokers(invoker Invoker)
SetInvokers sets invoker into local memory
type Exporter ¶
type Exporter interface {
// GetInvoker method is to get invoker.
GetInvoker() Invoker
// UnExport is to un export an exported service
UnExport()
}
Exporter is the interface that wraps the basic GetInvoker method and Destroy UnExport.
type HTTPHandlerHost ¶ added in v3.3.2
HTTPHandlerHost is an optional protocol capability for protocols backed by net/http that can host an existing HTTP handler on the same listener as framework-managed routes.
type Invocation ¶
type Invocation interface {
// MethodName gets invocation method name.
MethodName() string
// ActualMethodName gets actual invocation method name. It returns the method name been called if it's a generic call
ActualMethodName() string
// ParameterTypeNames gets invocation parameter type names.
ParameterTypeNames() []string
// ParameterTypes gets invocation parameter types.
ParameterTypes() []reflect.Type
// ParameterValues gets invocation parameter values.
ParameterValues() []reflect.Value
// ParameterRawValues gets raw invocation parameter values.
ParameterRawValues() []any
// Arguments gets arguments.
Arguments() []any
// Reply gets response of request
Reply() any
// Invoker gets the invoker in current context.
Invoker() Invoker
// IsGenericInvocation gets if this is a generic invocation
IsGenericInvocation() bool
Attachments() map[string]any
SetAttachment(key string, value any)
GetAttachment(key string) (string, bool)
GetAttachmentInterface(string) any
GetAttachmentWithDefaultValue(key string, defaultValue string) string
GetAttachmentAsContext() context.Context
MergeAttachmentFromContext(ctx context.Context)
// Attributes firstly introduced on dubbo-java 2.7.6. It is
// used in internal invocation, that is, it's not passed between
// server and client.
Attributes() map[string]any
SetAttribute(key string, value any)
GetAttribute(key string) (any, bool)
GetAttributeWithDefaultValue(key string, defaultValue any) any
}
Invocation is a interface which is invocation for each remote method.
type Invoker ¶
type Invoker interface {
common.Node
// Invoke the invocation and return result.
Invoke(context.Context, Invocation) result.Result
}
Invoker the service invocation interface for the consumer Extension - Invoker
func GetBlackListInvokers ¶
GetBlackListInvokers get at most size of blockSize invokers from black list
type Protocol ¶
type Protocol interface {
// Export method is to export service for remote invocation
Export(invoker Invoker) Exporter
// Refer method is to refer a remote service
Refer(url *common.URL) Invoker
// Destroy method will destroy all invokers and exporters, so it only is called once.
Destroy()
}
Protocol is the interface that wraps the basic Export, Refer and Destroy method.
type RPCStatus ¶
type RPCStatus struct {
// contains filtered or unexported fields
}
RPCStatus is URL statistics.
func GetMethodStatus ¶
GetMethodStatus get method RPC status.
func (*RPCStatus) GetFailedElapsed ¶
GetFailedElapsed gets failed elapsed.
func (*RPCStatus) GetFailedMaxElapsed ¶
GetFailedMaxElapsed gets failed max elapsed.
func (*RPCStatus) GetLastRequestFailedTimestamp ¶
GetLastRequestFailedTimestamp gets last request failed timestamp.
func (*RPCStatus) GetMaxElapsed ¶
GetMaxElapsed gets max elapsed.
func (*RPCStatus) GetSucceededMaxElapsed ¶
GetSucceededMaxElapsed gets succeeded max elapsed.
func (*RPCStatus) GetSuccessiveRequestFailureCount ¶
GetSuccessiveRequestFailureCount gets successive request failure count.
func (*RPCStatus) GetTotalElapsed ¶
GetTotalElapsed gets total elapsed.
type RegistryUnregisterer ¶ added in v3.3.2
type RegistryUnregisterer interface {
UnregisterRegistries()
}
RegistryUnregisterer is an optional protocol capability used during graceful shutdown. Implementations should only unregister exported services from the registry and must not destroy protocol servers or unexport providers as part of this step.