rpc

package
v0.0.0-...-ef34fa7 Latest Latest
Warning

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

Go to latest
Published: May 12, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PT_REQUEST  = true
	PT_RESPONSE = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiProcessor

type ApiProcessor interface {
	Start() (err error)
	ProcessRequest(req *Packet) (resp Params)
}

type Connection

type Connection struct {
	Addr string
	// contains filtered or unexported fields
}

func GetConnection

func GetConnection(c *net.TCPConn) *Connection

func NewConnection

func NewConnection(addr string) *Connection

func (*Connection) Close

func (conn *Connection) Close() error

func (*Connection) Connect

func (conn *Connection) Connect() (err error)

func (*Connection) Send

func (conn *Connection) Send(packet *Packet) (*Packet, error)

func (*Connection) String

func (conn *Connection) String() string

type Node

type Node struct {
	Name      string
	Addr      string
	Processor ApiProcessor
	// contains filtered or unexported fields
}

func NewNode

func NewNode(name, addr string, processor ApiProcessor) (*Node, error)

func (*Node) Close

func (node *Node) Close() error

func (*Node) Run

func (node *Node) Run() (err error)

type Packet

type Packet struct {
	Type  bool
	CmdID int
	Data  Params
}

func (*Packet) String

func (p *Packet) String() string

type Params

type Params map[string]string

func NewParams

func NewParams() Params

func (Params) String

func (p Params) String() string

Jump to

Keyboard shortcuts

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