Documentation ¶
Index ¶
- Variables
- type GrpcClient
- func (c *GrpcClient) Call(ctx context.Context, servicePath, serviceMethod string, argv interface{}, ...) error
- func (c *GrpcClient) Close() error
- func (c *GrpcClient) Connect(network, address string) error
- func (c *GrpcClient) GetConn() net.Conn
- func (c *GrpcClient) Go(ctx context.Context, servicePath, serviceMethod string, args interface{}, ...) *client.Call
- func (c *GrpcClient) IsClosing() bool
- func (c *GrpcClient) IsShutdown() bool
- func (c *GrpcClient) RegisterServerMessageChan(ch chan<- *protocol.Message)
- func (c *GrpcClient) RemoteAddr() string
- func (c *GrpcClient) SendRaw(ctx context.Context, r *protocol.Message) (map[string]string, []byte, error)
- func (c *GrpcClient) UnregisterServerMessageChan()
- type GrpcClientPlugin
- func (c *GrpcClientPlugin) DeleteCachedClient(client client.RPCClient, k, servicePath, serviceMethod string)
- func (c *GrpcClientPlugin) FindCachedClient(k, servicePath, serviceMethod string) client.RPCClient
- func (c *GrpcClientPlugin) GenerateClient(k, servicePath, serviceMethod string) (client client.RPCClient, err error)
- func (c *GrpcClientPlugin) SetCachedClient(client client.RPCClient, k, servicePath, serviceMethod string)
- type GrpcServerPlugin
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotSupported = errors.New("feature not supported") ErrClientNotRegistered = errors.New("grpc client not registered") ErrGrpcMethodNotFound = errors.New("grpc method not found") ErrReplyMustBePointer = errors.New("reply must be pointer type") ErrGrpcClientBuilderNotFound = errors.New("grpc client builder not found") ErrGrpcReplyCannotSet = errors.New("grpc reply can not be set") )
Errors for grpc client.
Functions ¶
This section is empty.
Types ¶
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
GrpcClient is a grpc client wrapper and implements RPCClient interface.
func (*GrpcClient) Call ¶
func (c *GrpcClient) Call(ctx context.Context, servicePath, serviceMethod string, argv interface{}, reply interface{}) error
Call invoke the grpc sevice.
func (*GrpcClient) Connect ¶
func (c *GrpcClient) Connect(network, address string) error
Connect connects the server. not supported because the grpc.ClientConn has connected in case of init.
func (*GrpcClient) GetConn ¶
func (c *GrpcClient) GetConn() net.Conn
GetConn returns underlying net.Conn. Always returns nil because grpc.ClientConn has not implement net.Conn.
func (*GrpcClient) Go ¶
func (c *GrpcClient) Go(ctx context.Context, servicePath, serviceMethod string, args interface{}, reply interface{}, done chan *client.Call) *client.Call
Go calls the grpc servics asynchronizously.
func (*GrpcClient) IsClosing ¶
func (c *GrpcClient) IsClosing() bool
IsClosing return closed or not.
func (*GrpcClient) IsShutdown ¶
func (c *GrpcClient) IsShutdown() bool
IsShutdown return closed or not.
func (*GrpcClient) RegisterServerMessageChan ¶
func (c *GrpcClient) RegisterServerMessageChan(ch chan<- *protocol.Message)
RegisterServerMessageChan register stream chan. not supported.
func (*GrpcClient) RemoteAddr ¶
func (c *GrpcClient) RemoteAddr() string
RemoteAddr returns the remote address.
func (*GrpcClient) SendRaw ¶
func (c *GrpcClient) SendRaw(ctx context.Context, r *protocol.Message) (map[string]string, []byte, error)
SendRaw sends raw data. not supported.
func (*GrpcClient) UnregisterServerMessageChan ¶
func (c *GrpcClient) UnregisterServerMessageChan()
UnregisterServerMessageChan unregister stream chan. not supported.
type GrpcClientPlugin ¶
type GrpcClientPlugin struct {
// contains filtered or unexported fields
}
GrpcClientPlugin is used for managing rpcx clients for grpc protocol.
func NewGrpcClientPlugin ¶
func NewGrpcClientPlugin(dialOpts []grpc.DialOption, callOpts []grpc.CallOption) *GrpcClientPlugin
NewGrpcClientPlugin creates a new GrpcClientPlugin.
func (*GrpcClientPlugin) DeleteCachedClient ¶
func (c *GrpcClientPlugin) DeleteCachedClient(client client.RPCClient, k, servicePath, serviceMethod string)
DeleteCachedClient deletes an exited client.
func (*GrpcClientPlugin) FindCachedClient ¶
func (c *GrpcClientPlugin) FindCachedClient(k, servicePath, serviceMethod string) client.RPCClient
FindCachedClient gets a cached client if exist.
func (*GrpcClientPlugin) GenerateClient ¶
func (c *GrpcClientPlugin) GenerateClient(k, servicePath, serviceMethod string) (client client.RPCClient, err error)
GenerateClient generates an new grpc client.
func (*GrpcClientPlugin) SetCachedClient ¶
func (c *GrpcClientPlugin) SetCachedClient(client client.RPCClient, k, servicePath, serviceMethod string)
SetCachedClient sets the cache client.
type GrpcServerPlugin ¶
type GrpcServerPlugin struct {
// contains filtered or unexported fields
}
GrpcServerPlugin supports grpc services.
func NewGrpcServerPlugin ¶
func NewGrpcServerPlugin() *GrpcServerPlugin
NewGrpcServerPlugin creates a new grpc server.
func (*GrpcServerPlugin) Close ¶
func (s *GrpcServerPlugin) Close() error
Close closes the grpc server.
func (*GrpcServerPlugin) MuxMatch ¶
func (s *GrpcServerPlugin) MuxMatch(m cmux.CMux)
MuxMatch splits grpc Listener.
func (*GrpcServerPlugin) RegisterService ¶
func (s *GrpcServerPlugin) RegisterService(registerFunc func(grpcServer *grpc.Server))
RegisterService registers grpc service by this method.
func (*GrpcServerPlugin) Start ¶
func (s *GrpcServerPlugin) Start() error
Start stats the grpc server.