Documentation
¶
Overview ¶
Package client is an interface for any protocol's client
Index ¶
Constants ¶
const DefaultPoolSize = 50
DefaultPoolSize is 500
Variables ¶
var ErrCanceled = errors.New("request cancelled")
ErrCanceled means Request is canceled by context management
Functions ¶
func GetFailureMap ¶ added in v1.0.1
GetFailureMap return failure map
func InstallPlugin ¶
InstallPlugin is plugin for the new function
Types ¶
type NewFunc ¶
type NewFunc func(Options) (ProtocolClient, error)
NewFunc is function for the client
func GetClientNewFunc ¶
GetClientNewFunc is to get the client
type Options ¶
type Options struct {
Service string
PoolSize int
Endpoint string
PoolTTL time.Duration
TLSConfig *tls.Config
Failure map[string]bool
}
Options is configs for client creation
type ProtocolClient ¶
type ProtocolClient interface {
// TODO use invocation.Response as rsp
Call(ctx context.Context, addr string, inv *invocation.Invocation, rsp interface{}) error
String() string
Close() error
}
ProtocolClient is the interface to communicate with one kind of ProtocolServer, it is used in transport handler rcp protocol client,http protocol client,or you can implement your own
func CreateClient ¶
func CreateClient(protocol, service, endpoint string) (ProtocolClient, error)
CreateClient is for to create client based on protocol and the service name
func GetClient ¶
func GetClient(protocol, service, endpoint string) (ProtocolClient, error)
GetClient is to get the client based on protocol, service,endpoint name
type TransportFailure ¶ added in v1.1.1
type TransportFailure struct {
Message string
}
TransportFailure is caused by client call failure for example: resp, err = client.Do(req) if err is not nil then should wrap original error with TransportFailure
func (TransportFailure) Error ¶ added in v1.1.1
func (e TransportFailure) Error() string
Error return error message