rpc

package module
v0.0.0-...-e598fcb Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2014 License: MIT Imports: 6 Imported by: 13

README

rpc

RPC helpers

Documentation

Overview

Package rpc provides helper structs for rpc server and client implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Name    string
	Network string
	Address string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(name, network, address string) (*Client, error)

func (*Client) Call

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

Call performs the rpc call, trying to redial if the connection was shut down.

type Server

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

func NewServer

func NewServer(name string, rpcServer interface{}, addr string) *Server

NewServer creates a new server providing with the given rpc name, rpc object, and tcp address.

func (*Server) Accept

func (s *Server) Accept()

Accept starts accepting calls. This method blocks.

func (*Server) Close

func (s *Server) Close() error

func (*Server) RegisterAndListen

func (s *Server) RegisterAndListen() error

RegisterAndListen does what is says. The caller is responsible to Close() the server afterwards.

type ServerPair

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

func NewServerPair

func NewServerPair(name string, main, operations *Server) *ServerPair

NewServerPair creates a new rpc server pair with the given name.

func (*ServerPair) Accept

func (p *ServerPair) Accept()

Accept starts accepting calls. This method blocks.

func (*ServerPair) Close

func (p *ServerPair) Close() error

func (*ServerPair) RegisterAndListen

func (p *ServerPair) RegisterAndListen() error

Jump to

Keyboard shortcuts

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