rpc

package
v0.0.0-...-f27897a Latest Latest
Warning

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

Go to latest
Published: May 27, 2014 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package rpc provides RPC server and clients specific to Cockroach.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Ready chan struct{} // Closed when client is connected

	*rpc.Client // Embedded RPC client
	// contains filtered or unexported fields
}

Client is a Cockroach-specific RPC client with an embedded go rpc.Client struct.

func NewClient

func NewClient(addr net.Addr) *Client

NewClient returns a client RPC stub for the specified address (usually a TCP host:port, but for testing may be a unix domain socket). The process-wide client RPC cache is consulted first; if the requested client is not present, it's created and the cache is updated. The returned client is returned immediately and may not be healthy.

func (*Client) Addr

func (c *Client) Addr() net.Addr

Addr returns remote address of the client.

func (*Client) Close

func (c *Client) Close() error

Close closes the client connection.

func (*Client) LocalAddr

func (c *Client) LocalAddr() net.Addr

LocalAddr returns the local address of the client.

type HeartbeatService

type HeartbeatService struct{}

A HeartbeatService exposes a method to echo its request params.

func (*HeartbeatService) Ping

func (hs *HeartbeatService) Ping(args *PingRequest, reply *PingResponse) error

Ping echos the contents of the request to the response.

type PingRequest

type PingRequest struct {
	Ping string // Echo this string with PingResponse.
}

A PingRequest specifies the string to echo in response.

type PingResponse

type PingResponse struct {
	Pong string // An echo of value sent with PingRequest.
}

A PingResponse contains the echoed ping request string.

type Server

type Server struct {
	*rpc.Server // Embedded RPC server instance
	// contains filtered or unexported fields
}

Server is a Cockroach-specific RPC server with an embedded go RPC server struct.

func NewServer

func NewServer(addr net.Addr) *Server

NewServer creates a new instance of Server.

func (*Server) AddCloseCallback

func (s *Server) AddCloseCallback(cb func(conn net.Conn))

AddCloseCallback adds a callback to the closeCallbacks slice to be invoked when a connection is closed.

func (*Server) Addr

func (s *Server) Addr() net.Addr

Addr returns the server's network address.

func (*Server) Close

func (s *Server) Close()

Close closes the listener.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

ListenAndServe begins listening and serving. This method should be invoked by goroutine as it will loop serving incoming client and not return until Close() is invoked.

Jump to

Keyboard shortcuts

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