Documentation ¶
Overview ¶
Package rpc implements the Cap'n Proto RPC protocol.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Base errors ErrConnClosed = errors.New("connection closed") ErrNotACapability = errors.New("not a capability") ErrCapTablePopulated = errors.New("capability table already populated") // RPC exceptions ExcClosed = rpcerr.Disconnected(ErrConnClosed) )
Functions ¶
func ListenAndServe ¶
ListenAndServe opens a listener on the given address and serves a Cap'n Proto RPC to incoming connections
network and address are passed to net.Listen. Use network "unix" for Unix Domain Sockets and "tcp" for regular TCP IP4 or IP6 connections.
ListenAndServe will take ownership of bootstrapClient and release it on exit.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn is a connection to another Cap'n Proto vat. It is safe to use from multiple goroutines.
func NewConn ¶
NewConn creates a new connection that communicates on a given transport.
Closing the connection will close the transport and release the bootstrap client provided in opts.
If opts == nil, sensible defaults are used. See Options for more info.
Once a connection is created, it will immediately start receiving requests from the transport.
func (*Conn) Bootstrap ¶
Bootstrap returns the remote vat's bootstrap interface. This creates a new client that the caller is responsible for releasing.
type ErrorReporter ¶
type ErrorReporter interface {
ReportError(error)
}
ErrorReporter can receive errors from a Conn. ReportError should be quick to return and should not use the Conn that it is attached to.
type Options ¶
type Options struct { // BootstrapClient is the capability that will be returned to the // remote peer when receiving a Bootstrap message. NewConn "steals" // this reference: it will release the client when the connection is // closed. BootstrapClient capnp.Client // ErrorReporter will be called upon when errors occur while the Conn // is receiving messages from the remote vat. ErrorReporter ErrorReporter // AbortTimeout specifies how long to block on sending an abort message // before closing the transport. If zero, then a reasonably short // timeout is used. AbortTimeout time.Duration }
Options specifies optional parameters for creating a Conn.
type Transport ¶
func NewPackedStreamTransport ¶
func NewPackedStreamTransport(rwc io.ReadWriteCloser) Transport
NewPackedStreamTransport is an alias for as transport.NewPackedStream
func NewStreamTransport ¶
func NewStreamTransport(rwc io.ReadWriteCloser) Transport
NewStreamTransport is an alias for as transport.NewStream
func NewTransport ¶
NewTransport is an alias for as transport.New