Documentation
¶
Overview ¶
Package rpc implements the Cap'n Proto RPC protocol.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrConnClosed = errors.New("rpc: connection closed")
)
Errors
Functions ¶
This section is empty.
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 ¶
func NewConn(t Transport, options ...ConnOption) *Conn
NewConn creates a new connection that communicates on c. Closing the connection will cause c to be closed.
type ConnOption ¶
type ConnOption struct {
// contains filtered or unexported fields
}
A ConnOption is an option for opening a connection.
func MainInterface ¶
func MainInterface(client capnp.Client) ConnOption
MainInterface specifies that the connection should use client when receiving bootstrap messages. By default, all bootstrap messages will fail.
func SendBufferSize ¶
func SendBufferSize(numMsgs int) ConnOption
SendBufferSize sets the number of outgoing messages to buffer on the connection. This is in addition to whatever buffering the connection's transport performs.
type Transport ¶
type Transport interface { // SendMessage sends msg. SendMessage(ctx context.Context, msg rpccapnp.Message) error // RecvMessage waits to receive a message and returns it. // Implementations may re-use buffers between calls, so the message is // only valid until the next call to RecvMessage. RecvMessage(ctx context.Context) (rpccapnp.Message, error) // Close releases any resources associated with the transport. Close() error }
Transport is the interface that abstracts sending and receiving individual messages of the Cap'n Proto RPC protocol.
func StreamTransport ¶
func StreamTransport(rwc io.ReadWriteCloser) Transport
StreamTransport creates a transport that sends and receives messages by serializing and deserializing unpacked Cap'n Proto messages. Closing the transport will close the underlying ReadWriteCloser.