Documentation ¶
Index ¶
- Constants
- Variables
- func IsCrossClusterRoutingErr(err error) bool
- func IsServerIDMismatchErr(err error) bool
- func NewLocalGRPCClient[C any, S any](desc *grpc.ServiceDesc, server S, ...) C
- type ClientBase
- func (c *ClientBase[T]) Call(ctx context.Context, caller func(client T) (any, error)) (any, error)
- func (c *ClientBase[T]) Close() error
- func (c *ClientBase[T]) EnableEncryption()
- func (c *ClientBase[T]) GetAddr() string
- func (c *ClientBase[T]) GetGrpcClient(ctx context.Context) (*clientConnWrapper[T], error)
- func (c *ClientBase[T]) GetNodeID() int64
- func (c *ClientBase[T]) GetRole() string
- func (c *ClientBase[T]) ReCall(ctx context.Context, caller func(client T) (any, error)) (any, error)
- func (c *ClientBase[T]) SetGetAddrFunc(f func() (string, error))
- func (c *ClientBase[T]) SetInternalTLSCertPool(cp *x509.CertPool)
- func (c *ClientBase[T]) SetNewGrpcClientFunc(f func(cc *grpc.ClientConn) T)
- func (c *ClientBase[T]) SetNodeID(nodeID int64)
- func (c *ClientBase[T]) SetRole(role string)
- func (c *ClientBase[T]) SetSession(sess *sessionutil.Session)
- type GrpcClient
- type GrpcComponent
- type Token
Constants ¶
const ( None = "" Zstd = "zstd" )
Variables ¶
var ErrConnect errConnect
ErrConnect is the instance for errors.Is target usage.
Functions ¶
func IsServerIDMismatchErr ¶
func NewLocalGRPCClient ¶
func NewLocalGRPCClient[C any, S any](desc *grpc.ServiceDesc, server S, clientCreator func(grpc.ClientConnInterface) C) C
NewLocalGRPCClient creates a grpc client that calls the server directly. !!! Warning: it didn't make any network or serialization/deserialization, so it's not promise concurrent safe. and there's no interceptor for client and server like the common grpc client/server.
Types ¶
type ClientBase ¶
type ClientBase[T interface { GetComponentStates(ctx context.Context, in *milvuspb.GetComponentStatesRequest, opts ...grpc.CallOption) (*milvuspb.ComponentStates, error) }] struct { ClientMaxSendSize int ClientMaxRecvSize int CompressionEnabled bool RetryServiceNameConfig string DialTimeout time.Duration KeepAliveTime time.Duration KeepAliveTimeout time.Duration MaxAttempts int InitialBackoff float64 MaxBackoff float64 NodeID atomic.Int64 // contains filtered or unexported fields }
ClientBase is a base of grpc client
func NewClientBase ¶
func NewClientBase[T interface { GetComponentStates(ctx context.Context, in *milvuspb.GetComponentStatesRequest, opts ...grpc.CallOption) (*milvuspb.ComponentStates, error) }](config *paramtable.GrpcClientConfig, serviceName string, ) *ClientBase[T]
func (*ClientBase[T]) Close ¶
func (c *ClientBase[T]) Close() error
Close close the client connection
func (*ClientBase[T]) EnableEncryption ¶
func (c *ClientBase[T]) EnableEncryption()
func (*ClientBase[T]) GetAddr ¶
func (c *ClientBase[T]) GetAddr() string
GetAddr returns address of client
func (*ClientBase[T]) GetGrpcClient ¶
func (c *ClientBase[T]) GetGrpcClient(ctx context.Context) (*clientConnWrapper[T], error)
GetGrpcClient returns grpc client
func (*ClientBase[T]) GetNodeID ¶
func (c *ClientBase[T]) GetNodeID() int64
GetNodeID returns ID of client
func (*ClientBase[T]) GetRole ¶
func (c *ClientBase[T]) GetRole() string
GetRole returns role of client
func (*ClientBase[T]) ReCall ¶
func (c *ClientBase[T]) ReCall(ctx context.Context, caller func(client T) (any, error)) (any, error)
ReCall does the grpc call twice
func (*ClientBase[T]) SetGetAddrFunc ¶
func (c *ClientBase[T]) SetGetAddrFunc(f func() (string, error))
SetGetAddrFunc sets getAddrFunc of client
func (*ClientBase[T]) SetInternalTLSCertPool ¶
func (c *ClientBase[T]) SetInternalTLSCertPool(cp *x509.CertPool)
func (*ClientBase[T]) SetNewGrpcClientFunc ¶
func (c *ClientBase[T]) SetNewGrpcClientFunc(f func(cc *grpc.ClientConn) T)
SetNewGrpcClientFunc sets newGrpcClient of client
func (*ClientBase[T]) SetNodeID ¶
func (c *ClientBase[T]) SetNodeID(nodeID int64)
SetNodeID set ID role of client
func (*ClientBase[T]) SetRole ¶
func (c *ClientBase[T]) SetRole(role string)
SetRole sets role of client
func (*ClientBase[T]) SetSession ¶
func (c *ClientBase[T]) SetSession(sess *sessionutil.Session)
SetSession set session role of client
type GrpcClient ¶
type GrpcClient[T GrpcComponent] interface { SetRole(string) GetRole() string SetGetAddrFunc(func() (string, error)) EnableEncryption() SetInternalTLSCertPool(cp *x509.CertPool) SetNewGrpcClientFunc(func(cc *grpc.ClientConn) T) ReCall(ctx context.Context, caller func(client T) (any, error)) (any, error) Call(ctx context.Context, caller func(client T) (any, error)) (any, error) Close() error SetNodeID(int64) GetNodeID() int64 SetSession(sess *sessionutil.Session) }
GrpcClient abstracts client of grpc
type GrpcComponent ¶
type GrpcComponent interface {
GetComponentStates(ctx context.Context, in *milvuspb.GetComponentStatesRequest, opts ...grpc.CallOption) (*milvuspb.ComponentStates, error)
}