streamclient

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 20 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientOptions

func GetClientOptions(ops []Option) []client.Option

GetClientOptions converts given streamclient.Option(s) to client.Option(s)

Types

type Option

type Option struct {
	F func(*client.Options, *utils.Slice)
}

func ConvertOptionFrom deprecated

func ConvertOptionFrom(opt client.Option) Option

Deprecated: it's not supposed to be called by users directly; may be removed in future versions. ConvertOptionFrom converts client.Option to streamclient.Option It's convenient for creating StreamOption from existing client.Option Note: NOT all client.Option(s) converted will work for stream clients; Even if it works for now, it's NOT guaranteed that it will always work for future versions.

func WithACLRules

func WithACLRules(rules ...acl.RejectFunc) Option

WithACLRules adds ACL rules. Note that the ACL checking process happens before service discovery.

func WithClientBasicInfo

func WithClientBasicInfo(ebi *rpcinfo.EndpointBasicInfo) Option

WithClientBasicInfo provides initial information for client endpoint in RPCInfo.

func WithCloseCallbacks

func WithCloseCallbacks(callback func() error) Option

WithCloseCallbacks adds callback to Close

func WithConnReporterEnabled

func WithConnReporterEnabled() Option

WithConnReporterEnabled to enable reporting connection pool stats.

func WithConnectTimeout

func WithConnectTimeout(d time.Duration) Option

WithConnectTimeout specifies the connection timeout.

func WithContextBackup

func WithContextBackup(backupHandler func(prev, cur context.Context) (ctx context.Context, backup bool)) Option

WithContextBackup enables local-session to retrieve context backuped by server, in case of user don't correctly pass context into next RPC call.

  • backupHandler pass a handler to check and handler user-defined key-values according to current context, returning backup==false means no need further operations.

func WithDestService

func WithDestService(svr string) Option

WithDestService specifies the name of target service.

func WithDiagnosisService

func WithDiagnosisService(ds diagnosis.Service) Option

WithDiagnosisService sets the diagnosis service for gathering debug information.

func WithDialer

func WithDialer(d remote.Dialer) Option

WithDialer sets the Dialer for creating connections.

func WithErrorHandler

func WithErrorHandler(f func(context.Context, error) error) Option

WithErrorHandler sets the error handler.

func WithFirstMetaHandler

func WithFirstMetaHandler(h remote.MetaHandler) Option

WithFirstMetaHandler adds a MetaHandler to the beginning of the current list.

func WithGRPCConnPoolSize

func WithGRPCConnPoolSize(s uint32) Option

WithGRPCConnPoolSize sets the value for the client connection pool size.

func WithGRPCInitialConnWindowSize

func WithGRPCInitialConnWindowSize(s uint32) Option

WithGRPCInitialConnWindowSize sets the value for initial window size on a connection of grpc. The lower bound for window size is 64K and any value smaller than that will be ignored. It corresponds to the WithInitialConnWindowSize DialOption of gRPC.

func WithGRPCInitialWindowSize

func WithGRPCInitialWindowSize(s uint32) Option

WithGRPCInitialWindowSize sets the value for initial window size on a grpc stream. The lower bound for window size is 64K and any value smaller than that will be ignored. It corresponds to the WithInitialWindowSize DialOption of gRPC.

func WithGRPCKeepaliveParams

func WithGRPCKeepaliveParams(kp grpc.ClientKeepalive) Option

WithGRPCKeepaliveParams returns a DialOption that specifies keepalive parameters for the client transport. It corresponds to the WithKeepaliveParams DialOption of gRPC.

func WithGRPCMaxHeaderListSize

func WithGRPCMaxHeaderListSize(s uint32) Option

WithGRPCMaxHeaderListSize returns a DialOption that specifies the maximum (uncompressed) size of header list that the client is prepared to accept. It corresponds to the WithMaxHeaderListSize DialOption of gRPC.

func WithGRPCReadBufferSize

func WithGRPCReadBufferSize(s uint32) Option

WithGRPCReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most for each read syscall.

func WithGRPCTLSConfig

func WithGRPCTLSConfig(tlsConfig *tls.Config) Option

WithGRPCTLSConfig sets the TLS config for gRPC client.

func WithGRPCWriteBufferSize

func WithGRPCWriteBufferSize(s uint32) Option

WithGRPCWriteBufferSize determines how much data can be batched before writing on the wire. The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. The default value for this buffer is 32KB.

func WithHTTPResolver

func WithHTTPResolver(r http.Resolver) Option

WithHTTPResolver specifies resolver for url (which specified by WithURL).

func WithHostPorts

func WithHostPorts(hostPorts ...string) Option

WithHostPorts sets the host ports for a stream client.

func WithInstanceMW

func WithInstanceMW(mw endpoint.Middleware) Option

WithInstanceMW adds middleware for client to handle request after service discovery and loadbalance process.

func WithLoadBalancer

func WithLoadBalancer(lb loadbalance.Loadbalancer, opts ...*lbcache.Options) Option

WithLoadBalancer sets the loadbalancer for client.

func WithMetaHandler

func WithMetaHandler(h remote.MetaHandler) Option

WithMetaHandler adds a MetaHandler to the end of the current list.

func WithMiddleware

func WithMiddleware(mw endpoint.Middleware) Option

WithMiddleware adds middleware for client to handle request. NOTE: for streaming APIs (bidirectional, client, server), req is not valid, resp is *streaming.Result If you want to intercept recv/send calls, please use Recv/Send Middleware

func WithMiddlewareBuilder

func WithMiddlewareBuilder(mwb endpoint.MiddlewareBuilder) Option

WithMiddlewareBuilder adds middleware that depend on a per-client context for client to handle request NOTE: for streaming APIs (bidirectional, client, server), req is not valid, resp is *streaming.Result If you want to intercept recv/send calls, please use Recv/Send MiddlewareBuilder

func WithPayloadCodec

func WithPayloadCodec(c remote.PayloadCodec) Option

WithPayloadCodec to set a payloadCodec that handle other payload which not support by kitex

func WithProxy

func WithProxy(p proxy.ForwardProxy) Option

WithProxy sets the forward Proxy for client.

func WithRecvMiddleware

func WithRecvMiddleware(mw endpoint.RecvMiddleware) Option

WithRecvMiddleware adds middleware for client to handle response. It's used for intercepting stream.RecvMsg (called by Recv or CloseAndRecv) calls

func WithRecvMiddlewareBuilder

func WithRecvMiddlewareBuilder(mwb endpoint.RecvMiddlewareBuilder) Option

WithRecvMiddlewareBuilder adds middleware that depend on a per-client context for client to handle response

func WithResolver

func WithResolver(r discovery.Resolver) Option

WithResolver provides the Resolver for kitex client.

func WithSendMiddleware

func WithSendMiddleware(mw endpoint.SendMiddleware) Option

WithSendMiddleware adds middleware for client to handle request. It's used for intercepting stream.SendMsg (called by Send or SendAndClose) calls

func WithSendMiddlewareBuilder

func WithSendMiddlewareBuilder(mwb endpoint.SendMiddlewareBuilder) Option

WithSendMiddlewareBuilder adds middleware that depend on a per-client context for client to handle request

func WithStatsLevel

func WithStatsLevel(level stats.Level) Option

WithStatsLevel sets the stats level for client.

func WithSuite

func WithSuite(suite client.Suite) Option

WithSuite adds an option suite for client.

func WithTag

func WithTag(key, val string) Option

WithTag sets the customize tag for service discovery, eg: idc, cluster.

func WithTracer

func WithTracer(c stats.Tracer) Option

WithTracer adds a tracer to client.

func WithWarmingUp

func WithWarmingUp(wuo *warmup.ClientOption) Option

WithWarmingUp forces the client to do some warm-ups at the end of the initialization.

func WithXDSSuite

func WithXDSSuite(suite xds.ClientSuite) Option

WithXDSSuite is used to set the xds suite for the client.

func (*Option) GetClientOption deprecated

func (o *Option) GetClientOption() client.Option

Deprecated: it's not supposed to be called by users directly and may be removed in future versions. GetClientOption returns a client.Option

Jump to

Keyboard shortcuts

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