xrpc

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: GPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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