Documentation
¶
Overview ¶
Package rpc implements rpc engine.
Index ¶
- Variables
- func NopDrop(Request) error
- func NopSend(context.Context, int64, int32, bin.Encoder) error
- type DropHandler
- type Engine
- func (e *Engine) Close()
- func (e *Engine) Do(ctx context.Context, req Request) error
- func (e *Engine) ForceClose()
- func (e *Engine) NotifyAcks(ids []int64)
- func (e *Engine) NotifyError(msgID int64, rpcErr error)
- func (e *Engine) NotifyErrorAll(rpcErr error)
- func (e *Engine) NotifyResult(msgID int64, b *bin.Buffer) error
- type Options
- type Request
- type RetryLimitReachedErr
- type Send
Constants ¶
This section is empty.
Variables ¶
var ErrEngineClosed = errors.New("engine was closed")
ErrEngineClosed means that engine was closed.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine handles RPC requests.
func (*Engine) Close ¶
func (e *Engine) Close()
Close gracefully closes the engine. All pending requests will be awaited. All Do method calls of closed engine will return ErrEngineClosed error.
func (*Engine) Do ¶
Do sends request to server and blocks until response is received, performing multiple retries if needed.
func (*Engine) ForceClose ¶
func (e *Engine) ForceClose()
ForceClose forcibly closes the engine. All pending requests will be canceled. All Do method calls of closed engine will return ErrEngineClosed error.
func (*Engine) NotifyAcks ¶
NotifyAcks notifies engine about received acknowledgements.
func (*Engine) NotifyError ¶
NotifyError notifies engine about received RPC error.
func (*Engine) NotifyErrorAll ¶
NotifyErrorAll notifies every pending request about rpcErr, e.g. when the session they were sent in is gone and they must be sent again in a new one.
type Options ¶
type Options struct {
RetryInterval time.Duration
MaxRetries int
Logger log.Logger
Clock clock.Clock
DropHandler DropHandler
}
Options of rpc engine.
type RetryLimitReachedErr ¶
type RetryLimitReachedErr struct {
Retries int
}
RetryLimitReachedErr means that server does not acknowledge request after multiple retries.
Engine.Do no longer returns it: after the last resend it keeps waiting for the result until the context is done or the engine is closed. The type is kept for compatibility.
func (*RetryLimitReachedErr) Error ¶
func (r *RetryLimitReachedErr) Error() string
func (*RetryLimitReachedErr) Is ¶
func (r *RetryLimitReachedErr) Is(err error) bool
Is reports whether err is RetryLimitReachedErr.