Documentation ¶
Index ¶
Constants ¶
const ( JSONrpc = "*json" HTTPjson = "*http_jsonrpc" GOBrpc = "*gob" InternalRPC = "*internal" BiRPCJSON = "*birpc_json" BiRPCGOB = "*birpc_gob" BiRPCInternal = "*birpc_internal" )
Constants to define the codec for RpcClient
const ( PoolFirst = "*first" PoolAsync = "*async" PoolRandom = "*random" PoolNext = "*next" PoolFirstPositive = "*first_positive" PoolFirstPositiveAsync = "*first_positive_async" PoolParallel = "*parallel" PoolBroadcast = "*broadcast" PoolBroadcastSync = "*broadcast_sync" PoolBroadcastAsync = "*broadcast_async" )
Constants to define the strategy for RpcClientPool
Variables ¶
var ( ErrReqUnsynchronized = errors.New("REQ_UNSYNCHRONIZED") ErrUnsupporteServiceMethod = errors.New("UNSUPPORTED_SERVICE_METHOD") ErrWrongArgsType = errors.New("WRONG_ARGS_TYPE") ErrWrongReplyType = errors.New("WRONG_REPLY_TYPE") ErrDisconnected = errors.New("DISCONNECTED") ErrReplyTimeout = errors.New("REPLY_TIMEOUT") ErrFailedReconnect = errors.New("FAILED_RECONNECT") ErrInternallyDisconnected = errors.New("INTERNALLY_DISCONNECTED") ErrUnsupportedCodec = errors.New("UNSUPPORTED_CODEC") ErrSessionNotFound = errors.New("SESSION_NOT_FOUND") ErrPartiallyExecuted = errors.New("PARTIALLY_EXECUTED") ErrUnsupportedBiRPC = errors.New("UNSUPPORTED_BIRPC") )
Errors that library may return back
Functions ¶
func IsNetworkError ¶
IsNetworkError will decide if an error is network generated or RPC one
Types ¶
type HTTPjsonRPCClient ¶
type HTTPjsonRPCClient struct {
// contains filtered or unexported fields
}
HTTPjsonRPCClient only for the rpc over http
type JSONrpcResponse ¶
type JSONrpcResponse struct { ID uint64 Result *json.RawMessage Error interface{} }
JSONrpcResponse is the response received from JSON RPC
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient implements ClientConnector
func NewRPCClient ¶
func NewRPCClient(ctx *context.Context, transport, addr string, tls bool, keyPath, certPath, caPath string, connectAttempts, reconnects int, maxReconnectInterval time.Duration, delayFunc func(time.Duration, time.Duration) func() time.Duration, connTimeout, replyTimeout time.Duration, codec string, internalChan chan birpc.ClientConnector, lazyConnect bool, biRPCClient interface{}) (rpcClient *RPCClient, err error)
NewRPCClient creates a client based on the config
type RPCCloner ¶
type RPCCloner interface {
RPCClone() (interface{}, error)
}
RPCCloner is an interface for objects to clone parts of themselves which are affected by concurrency at the time of RPC call
type RPCParallelClientPool ¶
type RPCParallelClientPool struct {
// contains filtered or unexported fields
}
RPCParallelClientPool implements ClientConnector
func NewRPCParallelClientPool ¶
func NewRPCParallelClientPool(ctx *context.Context, transport, addr string, tls bool, keyPath, certPath, caPath string, connectAttempts, reconnects int, maxReconnectInterval time.Duration, delayFunc func(time.Duration, time.Duration) func() time.Duration, connTimeout, replyTimeout time.Duration, codec string, internalChan chan birpc.ClientConnector, maxCounter int64, initConns bool, biRPCClient interface{}) (rpcClient *RPCParallelClientPool, err error)
NewRPCParallelClientPool returns a new RPCParallelClientPool
type RPCPool ¶
type RPCPool struct {
// contains filtered or unexported fields
}
RPCPool is a pool of connections
func NewRPCPool ¶
NewRPCPool creates RPCPool
func (*RPCPool) AddClient ¶
func (pool *RPCPool) AddClient(rcc birpc.ClientConnector)
AddClient adds a client connection in the pool