labrpc

package
v0.0.0-...-3029327 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestBasic

func TestBasic(t *testing.T)

func TestBenchmark

func TestBenchmark(t *testing.T)

func TestConcurrentMany

func TestConcurrentMany(t *testing.T)

test RPCs from concurrent ClientEnds

func TestConcurrentOne

func TestConcurrentOne(t *testing.T)

test concurrent RPCs from a single ClientEnd

func TestCounts

func TestCounts(t *testing.T)

test net.GetCount()

func TestDisconnect

func TestDisconnect(t *testing.T)

does net.Enable(endname, false) really disconnect a client?

func TestKilled

func TestKilled(t *testing.T)

if an RPC is stuck in a server, and the server is killed with DeleteServer(), does the RPC get un-stuck?

func TestRegression1

func TestRegression1(t *testing.T)

regression: an RPC that's delayed during Enabled=false should not delay subsequent RPCs (e.g. after Enabled=true).

func TestTypes

func TestTypes(t *testing.T)

func TestUnreliable

func TestUnreliable(t *testing.T)

test unreliable

Types

type ClientEnd

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

func (*ClientEnd) Call

func (e *ClientEnd) Call(svcMeth string, args interface{}, reply interface{}) bool

send an RPC, wait for the reply. the return value indicates success; false means that no reply was received from the server.

type JunkArgs

type JunkArgs struct {
	X int
}

type JunkReply

type JunkReply struct {
	X string
}

type JunkServer

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

func (*JunkServer) Handler1

func (js *JunkServer) Handler1(args string, reply *int)

func (*JunkServer) Handler2

func (js *JunkServer) Handler2(args int, reply *string)

func (*JunkServer) Handler3

func (js *JunkServer) Handler3(args int, reply *int)

func (*JunkServer) Handler4

func (js *JunkServer) Handler4(args *JunkArgs, reply *JunkReply)

args is a pointer

func (*JunkServer) Handler5

func (js *JunkServer) Handler5(args JunkArgs, reply *JunkReply)

args is a not pointer

type Network

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

func MakeNetwork

func MakeNetwork() *Network

func (*Network) AddServer

func (rn *Network) AddServer(servername interface{}, rs *Server)

func (*Network) Cleanup

func (rn *Network) Cleanup()

func (*Network) Connect

func (rn *Network) Connect(endname interface{}, servername interface{})

connect a ClientEnd to a server. a ClientEnd can only be connected once in its lifetime.

func (*Network) DeleteServer

func (rn *Network) DeleteServer(servername interface{})

func (*Network) Enable

func (rn *Network) Enable(endname interface{}, enabled bool)

enable/disable a ClientEnd.

func (*Network) GetCount

func (rn *Network) GetCount(servername interface{}) int

get a server's count of incoming RPCs.

func (*Network) GetTotalCount

func (rn *Network) GetTotalCount() int

func (*Network) IsServerDead

func (rn *Network) IsServerDead(endname interface{}, servername interface{}, server *Server) bool

func (*Network) LongDelays

func (rn *Network) LongDelays(yes bool)

func (*Network) LongReordering

func (rn *Network) LongReordering(yes bool)

func (*Network) MakeEnd

func (rn *Network) MakeEnd(endname interface{}) *ClientEnd

create a client end-point. start the thread that listens and delivers.

func (*Network) ProcessReq

func (rn *Network) ProcessReq(req reqMsg)

func (*Network) ReadEndnameInfo

func (rn *Network) ReadEndnameInfo(endname interface{}) (enabled bool,
	servername interface{}, server *Server, reliable bool, longreordering bool,
)

func (*Network) Reliable

func (rn *Network) Reliable(yes bool)

type Server

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

a server is a collection of services, all sharing the same rpc dispatcher. so that e.g. both a Raft and a k/v server can listen to the same rpc endpoint.

func MakeServer

func MakeServer() *Server

func (*Server) AddService

func (rs *Server) AddService(svc *Service)

func (*Server) GetCount

func (rs *Server) GetCount() int

type Service

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

an object with methods that can be called via RPC. a single server may have more than one Service.

func MakeService

func MakeService(rcvr interface{}) *Service

Jump to

Keyboard shortcuts

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