rpc

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRPCTimeout = 1 * time.Minute

DefaultRPCTimeout - default RPC timeout is one minute.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// Method to validate first argument of any RPC call.
	Authenticate() error
}

Authenticator - validator of first argument of any RPC call.

type CallRequest

type CallRequest struct {
	Method   string
	ArgBytes []byte
}

CallRequest - RPC call request parameters.

type CallResponse

type CallResponse struct {
	Error      string
	ReplyBytes []byte
}

CallResponse - RPC call response parameters.

type Client

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

Client - http based RPC client.

func NewClient

func NewClient(serviceURL *xnet.URL, tlsConfig *tls.Config, timeout time.Duration) (*Client, error)

NewClient - returns new RPC client.

func (*Client) Call

func (client *Client) Call(serviceMethod string, args, reply interface{}) error

Call - calls service method on RPC server.

func (*Client) Close

func (client *Client) Close() error

Close closes all idle connections of the underlying http client

type Pool

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

A Pool is a type-safe wrapper around a sync.Pool.

func NewPool

func NewPool() Pool

NewPool constructs a new Pool.

func (Pool) Get

func (p Pool) Get() *bytes.Buffer

Get retrieves a bytes.Buffer from the pool, creating one if necessary.

func (Pool) Put

func (p Pool) Put(buf *bytes.Buffer)

Put - returns a bytes.Buffer to the pool.

type Server

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

Server - HTTP based RPC server.

func NewServer

func NewServer() *Server

NewServer - returns new RPC server.

func (*Server) RegisterName

func (server *Server) RegisterName(name string, receiver interface{}) error

RegisterName - registers receiver with given name to handle RPC requests.

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP - handles RPC on HTTP request.

Jump to

Keyboard shortcuts

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