Documentation ¶
Overview ¶
Package client provides APIs for starting RPC calls.
Index ¶
- type CallOption
- type CallOptions
- type Client
- type ClientDefinition
- type ClientInfo
- type ClientOption
- func SetApplication(application *global.ApplicationConfig) ClientOption
- func SetClientConsumer(consumer *global.ConsumerConfig) ClientOption
- func SetClientMetrics(metrics *global.MetricsConfig) ClientOption
- func SetClientOtel(otel *global.OtelConfig) ClientOption
- func SetClientRegistries(regs map[string]*global.RegistryConfig) ClientOption
- func SetClientShutdown(shutdown *global.ShutdownConfig) ClientOption
- func WithClientClusterAdaptiveService() ClientOption
- func WithClientClusterAvailable() ClientOption
- func WithClientClusterBroadcast() ClientOption
- func WithClientClusterFailBack() ClientOption
- func WithClientClusterFailFast() ClientOption
- func WithClientClusterFailOver() ClientOption
- func WithClientClusterFailSafe() ClientOption
- func WithClientClusterForking() ClientOption
- func WithClientClusterStrategy(strategy string) ClientOption
- func WithClientClusterZoneAware() ClientOption
- func WithClientFilter(filter string) ClientOption
- func WithClientForceTag() ClientOption
- func WithClientGroup(group string) ClientOption
- func WithClientLoadBalance(lb string) ClientOption
- func WithClientLoadBalanceConsistentHashing() ClientOption
- func WithClientLoadBalanceLeastActive() ClientOption
- func WithClientLoadBalanceP2C() ClientOption
- func WithClientLoadBalanceRandom() ClientOption
- func WithClientLoadBalanceRoundRobin() ClientOption
- func WithClientMeshProviderPort(port int) ClientOption
- func WithClientNoCheck() ClientOption
- func WithClientParam(k, v string) ClientOption
- func WithClientParams(params map[string]string) ClientOption
- func WithClientProtocol(protocol string) ClientOption
- func WithClientProtocolDubbo() ClientOption
- func WithClientProtocolJsonRPC() ClientOption
- func WithClientProtocolTriple() ClientOption
- func WithClientProvidedBy(providedBy string) ClientOption
- func WithClientRegistry(opts ...registry.Option) ClientOption
- func WithClientRegistryIDs(registryIDs ...string) ClientOption
- func WithClientRequestTimeout(timeout time.Duration) ClientOption
- func WithClientRetries(retries int) ClientOption
- func WithClientSerialization(ser string) ClientOption
- func WithClientSerializationJSON() ClientOption
- func WithClientShutdown(opts ...graceful_shutdown.Option) ClientOption
- func WithClientSticky() ClientOption
- func WithClientURL(url string) ClientOption
- func WithClientVersion(version string) ClientOption
- type ClientOptions
- type Connection
- func (conn *Connection) CallBidiStream(ctx context.Context, methodName string, opts ...CallOption) (interface{}, error)
- func (conn *Connection) CallClientStream(ctx context.Context, methodName string, opts ...CallOption) (interface{}, error)
- func (conn *Connection) CallServerStream(ctx context.Context, req interface{}, methodName string, opts ...CallOption) (interface{}, error)
- func (conn *Connection) CallUnary(ctx context.Context, reqs []interface{}, resp interface{}, methodName string, ...) error
- type ReferenceOption
- func WithAsync() ReferenceOption
- func WithCheck() ReferenceOption
- func WithCluster(cluster string) ReferenceOption
- func WithClusterAdaptiveService() ReferenceOption
- func WithClusterAvailable() ReferenceOption
- func WithClusterBroadcast() ReferenceOption
- func WithClusterFailBack() ReferenceOption
- func WithClusterFailFast() ReferenceOption
- func WithClusterFailOver() ReferenceOption
- func WithClusterFailSafe() ReferenceOption
- func WithClusterForking() ReferenceOption
- func WithClusterZoneAware() ReferenceOption
- func WithFilter(filter string) ReferenceOption
- func WithForceTag() ReferenceOption
- func WithGeneric() ReferenceOption
- func WithGroup(group string) ReferenceOption
- func WithLoadBalance(lb string) ReferenceOption
- func WithLoadBalanceConsistentHashing() ReferenceOption
- func WithLoadBalanceLeastActive() ReferenceOption
- func WithLoadBalanceP2C() ReferenceOption
- func WithLoadBalanceRandom() ReferenceOption
- func WithLoadBalanceRoundRobin() ReferenceOption
- func WithMeshProviderPort(port int) ReferenceOption
- func WithMethod(opts ...config.MethodOption) ReferenceOption
- func WithParam(k, v string) ReferenceOption
- func WithParams(params map[string]string) ReferenceOption
- func WithProtocol(protocol string) ReferenceOption
- func WithProtocolDubbo() ReferenceOption
- func WithProtocolJsonRPC() ReferenceOption
- func WithProtocolTriple() ReferenceOption
- func WithProvidedBy(providedBy string) ReferenceOption
- func WithRegistryIDs(registryIDs ...string) ReferenceOption
- func WithRequestTimeout(timeout time.Duration) ReferenceOption
- func WithRetries(retries int) ReferenceOption
- func WithSerialization(serialization string) ReferenceOption
- func WithSerializationJSON() ReferenceOption
- func WithSticky() ReferenceOption
- func WithURL(url string) ReferenceOption
- func WithVersion(version string) ReferenceOption
- type ReferenceOptions
- func (refOpts *ReferenceOptions) CheckAvailable() bool
- func (refOpts *ReferenceOptions) GetInvoker() protocol.Invoker
- func (refOpts *ReferenceOptions) GetProxy() *proxy.Proxy
- func (refOpts *ReferenceOptions) GetRPCService() common.RPCService
- func (refOpts *ReferenceOptions) Implement(v common.RPCService)
- func (refOpts *ReferenceOptions) ReferWithInfo(info *ClientInfo)
- func (refOpts *ReferenceOptions) ReferWithService(srv common.RPCService)
- func (refOpts *ReferenceOptions) ReferWithServiceAndInfo(srv common.RPCService, info *ClientInfo)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption func(*CallOptions)
func WithCallRequestTimeout ¶
func WithCallRequestTimeout(timeout time.Duration) CallOption
WithCallRequestTimeout the maximum waiting time for one specific call, only works for 'tri' and 'dubbo' protocol
func WithCallRetries ¶
func WithCallRetries(retries int) CallOption
WithCallRetries the maximum retry times on request failure for one specific call, only works for 'tri' and 'dubbo' protocol
type CallOptions ¶
todo: need to be consistent with MethodConfig
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
ConsumerConfig
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
func (*Client) Dial ¶
func (cli *Client) Dial(interfaceName string, opts ...ReferenceOption) (*Connection, error)
func (*Client) DialWithInfo ¶
func (cli *Client) DialWithInfo(interfaceName string, info *ClientInfo, opts ...ReferenceOption) (*Connection, error)
type ClientDefinition ¶
type ClientDefinition struct { Svc interface{} Info *ClientInfo }
type ClientInfo ¶
type ClientInfo struct { InterfaceName string MethodNames []string ConnectionInjectFunc func(dubboCliRaw interface{}, conn *Connection) Meta map[string]interface{} }
type ClientOption ¶
type ClientOption func(*ClientOptions)
func SetApplication ¶
func SetApplication(application *global.ApplicationConfig) ClientOption
func SetClientConsumer ¶
func SetClientConsumer(consumer *global.ConsumerConfig) ClientOption
func SetClientMetrics ¶
func SetClientMetrics(metrics *global.MetricsConfig) ClientOption
func SetClientOtel ¶
func SetClientOtel(otel *global.OtelConfig) ClientOption
func SetClientRegistries ¶
func SetClientRegistries(regs map[string]*global.RegistryConfig) ClientOption
func SetClientShutdown ¶
func SetClientShutdown(shutdown *global.ShutdownConfig) ClientOption
func WithClientClusterAdaptiveService ¶
func WithClientClusterAdaptiveService() ClientOption
func WithClientClusterAvailable ¶
func WithClientClusterAvailable() ClientOption
func WithClientClusterBroadcast ¶
func WithClientClusterBroadcast() ClientOption
func WithClientClusterFailBack ¶
func WithClientClusterFailBack() ClientOption
func WithClientClusterFailFast ¶
func WithClientClusterFailFast() ClientOption
func WithClientClusterFailOver ¶
func WithClientClusterFailOver() ClientOption
func WithClientClusterFailSafe ¶
func WithClientClusterFailSafe() ClientOption
func WithClientClusterForking ¶
func WithClientClusterForking() ClientOption
func WithClientClusterStrategy ¶
func WithClientClusterStrategy(strategy string) ClientOption
func WithClientClusterZoneAware ¶
func WithClientClusterZoneAware() ClientOption
func WithClientFilter ¶
func WithClientFilter(filter string) ClientOption
todo(DMwangnima): change Filter Option like Cluster and LoadBalance
func WithClientForceTag ¶
func WithClientForceTag() ClientOption
func WithClientLoadBalance ¶
func WithClientLoadBalance(lb string) ClientOption
func WithClientLoadBalanceConsistentHashing ¶
func WithClientLoadBalanceConsistentHashing() ClientOption
func WithClientLoadBalanceLeastActive ¶
func WithClientLoadBalanceLeastActive() ClientOption
func WithClientLoadBalanceP2C ¶
func WithClientLoadBalanceP2C() ClientOption
func WithClientLoadBalanceRandom ¶
func WithClientLoadBalanceRandom() ClientOption
func WithClientLoadBalanceRoundRobin ¶
func WithClientLoadBalanceRoundRobin() ClientOption
func WithClientMeshProviderPort ¶
func WithClientMeshProviderPort(port int) ClientOption
func WithClientNoCheck ¶
func WithClientNoCheck() ClientOption
func WithClientParam ¶
func WithClientParam(k, v string) ClientOption
func WithClientParams ¶
func WithClientParams(params map[string]string) ClientOption
func WithClientProtocol ¶
func WithClientProtocol(protocol string) ClientOption
func WithClientProtocolDubbo ¶
func WithClientProtocolDubbo() ClientOption
func WithClientProtocolJsonRPC ¶
func WithClientProtocolJsonRPC() ClientOption
func WithClientProtocolTriple ¶
func WithClientProtocolTriple() ClientOption
func WithClientProvidedBy ¶
func WithClientProvidedBy(providedBy string) ClientOption
func WithClientRegistry ¶
func WithClientRegistry(opts ...registry.Option) ClientOption
func WithClientRegistryIDs ¶
func WithClientRegistryIDs(registryIDs ...string) ClientOption
todo(DMwangnima): think about a more ideal configuration style
func WithClientRequestTimeout ¶
func WithClientRequestTimeout(timeout time.Duration) ClientOption
func WithClientRetries ¶
func WithClientRetries(retries int) ClientOption
func WithClientSerialization ¶
func WithClientSerialization(ser string) ClientOption
func WithClientSerializationJSON ¶
func WithClientSerializationJSON() ClientOption
func WithClientShutdown ¶
func WithClientShutdown(opts ...graceful_shutdown.Option) ClientOption
func WithClientSticky ¶
func WithClientSticky() ClientOption
func WithClientURL ¶
func WithClientURL(url string) ClientOption
type ClientOptions ¶
type ClientOptions struct { Consumer *global.ConsumerConfig Application *global.ApplicationConfig Registries map[string]*global.RegistryConfig Shutdown *global.ShutdownConfig Metrics *global.MetricsConfig Otel *global.OtelConfig // contains filtered or unexported fields }
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
InterfaceName/group/version /ReferenceConfig
func (*Connection) CallBidiStream ¶
func (conn *Connection) CallBidiStream(ctx context.Context, methodName string, opts ...CallOption) (interface{}, error)
func (*Connection) CallClientStream ¶
func (conn *Connection) CallClientStream(ctx context.Context, methodName string, opts ...CallOption) (interface{}, error)
func (*Connection) CallServerStream ¶
func (conn *Connection) CallServerStream(ctx context.Context, req interface{}, methodName string, opts ...CallOption) (interface{}, error)
func (*Connection) CallUnary ¶
func (conn *Connection) CallUnary(ctx context.Context, reqs []interface{}, resp interface{}, methodName string, opts ...CallOption) error
type ReferenceOption ¶
type ReferenceOption func(*ReferenceOptions)
func WithAsync ¶
func WithAsync() ReferenceOption
func WithCheck ¶
func WithCheck() ReferenceOption
func WithCluster ¶
func WithCluster(cluster string) ReferenceOption
func WithClusterAdaptiveService ¶
func WithClusterAdaptiveService() ReferenceOption
func WithClusterAvailable ¶
func WithClusterAvailable() ReferenceOption
func WithClusterBroadcast ¶
func WithClusterBroadcast() ReferenceOption
func WithClusterFailBack ¶
func WithClusterFailBack() ReferenceOption
func WithClusterFailFast ¶
func WithClusterFailFast() ReferenceOption
func WithClusterFailOver ¶
func WithClusterFailOver() ReferenceOption
func WithClusterFailSafe ¶
func WithClusterFailSafe() ReferenceOption
func WithClusterForking ¶
func WithClusterForking() ReferenceOption
func WithClusterZoneAware ¶
func WithClusterZoneAware() ReferenceOption
func WithFilter ¶
func WithFilter(filter string) ReferenceOption
func WithForceTag ¶
func WithForceTag() ReferenceOption
func WithGeneric ¶
func WithGeneric() ReferenceOption
func WithGroup ¶
func WithGroup(group string) ReferenceOption
func WithLoadBalance ¶
func WithLoadBalance(lb string) ReferenceOption
func WithLoadBalanceConsistentHashing ¶
func WithLoadBalanceConsistentHashing() ReferenceOption
func WithLoadBalanceLeastActive ¶
func WithLoadBalanceLeastActive() ReferenceOption
func WithLoadBalanceP2C ¶
func WithLoadBalanceP2C() ReferenceOption
func WithLoadBalanceRandom ¶
func WithLoadBalanceRandom() ReferenceOption
func WithLoadBalanceRoundRobin ¶
func WithLoadBalanceRoundRobin() ReferenceOption
func WithMeshProviderPort ¶
func WithMeshProviderPort(port int) ReferenceOption
func WithMethod ¶
func WithMethod(opts ...config.MethodOption) ReferenceOption
func WithParam ¶
func WithParam(k, v string) ReferenceOption
func WithParams ¶
func WithParams(params map[string]string) ReferenceOption
func WithProtocol ¶
func WithProtocol(protocol string) ReferenceOption
func WithProtocolDubbo ¶
func WithProtocolDubbo() ReferenceOption
func WithProtocolJsonRPC ¶
func WithProtocolJsonRPC() ReferenceOption
func WithProtocolTriple ¶
func WithProtocolTriple() ReferenceOption
func WithProvidedBy ¶
func WithProvidedBy(providedBy string) ReferenceOption
func WithRegistryIDs ¶
func WithRegistryIDs(registryIDs ...string) ReferenceOption
func WithRequestTimeout ¶
func WithRequestTimeout(timeout time.Duration) ReferenceOption
func WithRetries ¶
func WithRetries(retries int) ReferenceOption
func WithSerialization ¶
func WithSerialization(serialization string) ReferenceOption
func WithSerializationJSON ¶
func WithSerializationJSON() ReferenceOption
func WithSticky ¶
func WithSticky() ReferenceOption
func WithURL ¶
func WithURL(url string) ReferenceOption
func WithVersion ¶
func WithVersion(version string) ReferenceOption
type ReferenceOptions ¶
type ReferenceOptions struct { Reference *global.ReferenceConfig Consumer *global.ConsumerConfig Metrics *global.MetricsConfig Otel *global.OtelConfig // contains filtered or unexported fields }
func (*ReferenceOptions) CheckAvailable ¶
func (refOpts *ReferenceOptions) CheckAvailable() bool
func (*ReferenceOptions) GetInvoker ¶
func (refOpts *ReferenceOptions) GetInvoker() protocol.Invoker
GetInvoker get invoker from ReferenceConfigs
func (*ReferenceOptions) GetProxy ¶
func (refOpts *ReferenceOptions) GetProxy() *proxy.Proxy
GetProxy gets proxy
func (*ReferenceOptions) GetRPCService ¶
func (refOpts *ReferenceOptions) GetRPCService() common.RPCService
GetRPCService gets RPCService from proxy
func (*ReferenceOptions) Implement ¶
func (refOpts *ReferenceOptions) Implement(v common.RPCService)
Implement @v is service provider implemented RPCService
func (*ReferenceOptions) ReferWithInfo ¶
func (refOpts *ReferenceOptions) ReferWithInfo(info *ClientInfo)
func (*ReferenceOptions) ReferWithService ¶
func (refOpts *ReferenceOptions) ReferWithService(srv common.RPCService)
ReferWithService retrieves invokers from urls.
func (*ReferenceOptions) ReferWithServiceAndInfo ¶
func (refOpts *ReferenceOptions) ReferWithServiceAndInfo(srv common.RPCService, info *ClientInfo)