rpc

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package rpc implements MessagePack RPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	Method string
	Args   interface{}
	Reply  interface{}
	Err    error
	Done   chan *Call
}

type Endpoint

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

Endpoint represents a MessagePack RPC peer.

func NewEndpoint

func NewEndpoint(r io.Reader, w io.Writer, c io.Closer, options ...Option) (*Endpoint, error)

NewEndpoint returns a new endpoint with the specified options.

func (*Endpoint) Call

func (e *Endpoint) Call(method string, reply interface{}, args ...interface{}) error

func (*Endpoint) Close

func (e *Endpoint) Close() error

Close releases the resources used by endpoint.

func (*Endpoint) Go

func (e *Endpoint) Go(method string, done chan *Call, reply interface{}, args ...interface{}) *Call

func (*Endpoint) Notify

func (e *Endpoint) Notify(method string, args ...interface{}) error

func (*Endpoint) Register

func (e *Endpoint) Register(method string, fn interface{}, args ...interface{}) error

Register registers handler fn for the specified method name.

When servicing a call, the arguments to fn are the values in args followed by the values passed from the peer.

func (*Endpoint) Serve

func (e *Endpoint) Serve() error

Serve serves incoming requests. Serve blocks until the peer disconnects or there is an error.

type Error

type Error struct {
	Value interface{}
}

func (Error) Error

func (e Error) Error() string

type Option

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

func WithExtensions

func WithExtensions(extensions msgpack.ExtensionMap) Option

func WithLogf

func WithLogf(f func(fmt string, args ...interface{})) Option

Jump to

Keyboard shortcuts

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