Documentation
¶
Overview ¶
Package rpc is a small, handwritten RPC framing layer for the in-process transport. It deliberately contains no protobuf generated code and no gRPC: service stubs in sdk/go/cloudpath/v1/* build on Client and Server here, and the A4 Plugin Host can swap the underlying transport.Transport for a named pipe or Unix socket without touching service contracts.
Frame semantics (see transport.Message):
client -> server KindUnary one request, exactly one terminal reply server -> client KindResponse terminal unary reply (Err set on failure) client -> server KindStreamReq open a server stream either direction KindStreamMsg stream payload client -> server KindStreamEnd half-close of the client send side server -> client KindStreamEndTerm server finished the stream (both sides) client -> server KindStreamCancel cancel the whole call
Index ¶
Constants ¶
const ( KindUnary = transport.KindUnary KindResponse = transport.KindResponse KindStreamReq = transport.KindStreamReq KindStreamMsg = transport.KindStreamMsg KindStreamEnd = transport.KindStreamEnd KindStreamEndTerm = transport.KindStreamEndTerm KindStreamCancel = transport.KindStreamCancel )
Frame kinds mirrored from the transport package for call-site readability.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the connection-scoped RPC client. One Client multiplexes many unary calls and streams over one Transport and is safe for concurrent use.
func (*Client) Call ¶
Call performs a unary request. resp data is JSON-marshaled; the returned bytes are the JSON-marshaled response body.
func (*Client) OpenStream ¶
OpenStream starts a server-streaming (or bidi) call.
type ClientStream ¶
type ClientStream struct {
// contains filtered or unexported fields
}
ClientStream is the client side of one stream call.
func (*ClientStream) Cancel ¶
func (s *ClientStream) Cancel(ctx context.Context) error
Cancel cancels the whole call; the server handler context is canceled.
func (*ClientStream) CloseSend ¶
func (s *ClientStream) CloseSend(ctx context.Context) error
CloseSend half-closes the client send side. The server may keep sending.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server dispatches frames from one Transport to registered handlers.
func (*Server) HandleStream ¶
func (s *Server) HandleStream(method string, fn func(ctx context.Context, body []byte, stream *ServerStream) error) *Server
HandleStream registers a stream handler for method.
type ServerStream ¶
type ServerStream struct {
// contains filtered or unexported fields
}
ServerStream is the server side of one stream call.