xrpc

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConnectionStr = ":8080"
	DefaultLog           = xlog.NewStdLog()
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(connStr string, timeout int) (*Client, error)

func (*Client) Call

func (c *Client) Call(method string, args interface{}, reply interface{}) error

make a client call to remote server(without retry)

func (*Client) CallTimeout

func (c *Client) CallTimeout(timeout int, method string, args interface{}, reply interface{}) error

func (*Client) Close

func (c *Client) Close() error

close the client connection

type Option

type Option func(*Options)

func ConnectionStr

func ConnectionStr(v string) Option

ConnectionStr: server connection string

func Log

func Log(v *xlog.Log) Option

Log: server log

type Options

type Options struct {
	ConnectionStr string
	Log           *xlog.Log
}

type Service

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

func NewService

func NewService(opts ...Option) (*Service, error)

creates a new Service with options

func (*Service) RegisterService

func (s *Service) RegisterService(rcvr interface{}) error

register service type for net/rpc

func (*Service) Start

func (s *Service) Start() error

accepts incoming connections

func (*Service) Stop

func (s *Service) Stop()

stops the rpc server

Jump to

Keyboard shortcuts

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