client

package
v3.2.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package client provides APIs for starting RPC calls.

Index

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

type CallOptions struct {
	RequestTimeout string
	Retries        string
}

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 WithClientGroup

func WithClientGroup(group string) ClientOption

is this needed?

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

func WithClientVersion

func WithClientVersion(version string) ClientOption

is this needed?

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL