Documentation ¶
Overview ¶
This package implements Native Client's simple RPC (SRPC).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add registers a handler for the named method. Fmt is a Native Client format string, a sequence of alphabetic characters representing the types of the parameter values, a colon, and then a sequence of alphabetic characters representing the types of the returned values. The format characters and corresponding dynamic types are:
b bool C []byte d float64 D []float64 h int // a file descriptor (aka handle) i int32 I []int32 s string
func Enabled ¶
func Enabled() bool
Enabled returns true if SRPC is enabled in the Native Client runtime.
func Serve ¶
Serve accepts new SRPC connections from the file descriptor fd and answers RPCs issued on those connections. It closes fd and returns an error if the imc_accept system call fails.
func ServeRuntime ¶
ServeRuntime serves RPCs issued by the Native Client embedded runtime. This should be called by main once all methods have been registered using Add.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client represents the client side of an SRPC connection.
type Handler ¶
A Handler is a handler for an SRPC method. It reads arguments from arg, checks size for array limits, writes return values to ret, and returns an Errno status code.
type RPC ¶
type RPC struct { Ret []interface{} // Return values Done chan *RPC // Channel where notification of done arrives Errno Errno // Status code // contains filtered or unexported fields }
An RPC represents a single RPC issued by a client.
Notes ¶
Bugs ¶
Add's format string should be replaced by analyzing the type of an arbitrary func passed in an interface{} using reflection.