rpc

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package rpc implements rpc engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NopSend

func NopSend(ctx context.Context, msgID int64, seqNo int32, in bin.Encoder) error

NopSend does nothing.

Types

type Config

type Config struct {
	RetryInterval time.Duration
	MaxRetries    int
	Logger        *zap.Logger
}

Config of rpc engine.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine handles RPC requests.

func New

func New(send Send, cfg Config) *Engine

New creates new rpc Engine.

func (*Engine) Do

func (e *Engine) Do(ctx context.Context, req Request) error

Do performs RPC request.

func (*Engine) NotifyAcks

func (e *Engine) NotifyAcks(ids []int64)

NotifyAcks notifies engine about received acknowledgements.

func (*Engine) NotifyError

func (e *Engine) NotifyError(msgID int64, rpcErr error)

NotifyError notifies engine about received RPC error.

func (*Engine) NotifyResult

func (e *Engine) NotifyResult(msgID int64, b *bin.Buffer) error

NotifyResult notifies engine about received RPC response.

type Request

type Request struct {
	ID       int64
	Sequence int32
	Input    bin.Encoder
	Output   bin.Decoder
}

Request represents client RPC request.

type Send

type Send func(ctx context.Context, msgID int64, seqNo int32, in bin.Encoder) error

Send is a function that sends requests to the server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL