Documentation
¶
Index ¶
Constants ¶
View Source
const (
SupportPackageIsVersion1 = true
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
func Dial ¶
func Dial(addr string, opt ...DialOption) (*ClientConn, error)
func DialContext ¶
func DialContext(ctx context.Context, addr string, opts ...DialOption) (*ClientConn, error)
func (*ClientConn) Close ¶
func (cc *ClientConn) Close() error
type ClientStream ¶
type ClientStream interface {
// CloseSend closes the send direction of the stream. It closes the stream
// when non-nil error is met.
CloseSend() error
Stream
}
ClientStream defines the interface a client stream has to satisfy.
func NewClientStream ¶
func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, api uint16) (ClientStream, error)
type Codec ¶
type DialOption ¶
type DialOption func(*dialOptions)
func WithCodec ¶
func WithCodec(c Codec) DialOption
type MethodDesc ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) RegisterService ¶
func (s *Server) RegisterService(sd *ServiceDesc, ss interface{})
RegisterService registers a service and its implementation to the gRPC server. It is called from the IDL generated code. This must be called before invoking Serve.
type ServerOption ¶
type ServerOption func(*options)
func CustomCodec ¶
func CustomCodec(c Codec) ServerOption
type ServerStream ¶
type ServerStream interface {
Stream
}
type ServiceDesc ¶
type ServiceDesc struct {
Index uint8
ServiceName string
// The pointer to the service interface. Used to check whether the user
// provided implementation satisfies the interface requirements.
HandlerType interface{}
Methods []MethodDesc
Streams []StreamDesc
Metadata interface{}
}
ServiceDesc represents an RPC service's specification.
type Stream ¶
type Stream interface {
// Context returns the context for this stream.
Context() context.Context
// SendMsg blocks until it sends m, the stream is done or the stream
// breaks.
// On error, it aborts the stream and returns an RPC status on client
// side. On server side, it simply returns the error to the caller.
// SendMsg is called by generated code. Also Users can call SendMsg
// directly when it is really needed in their use cases.
// It's safe to have a goroutine calling SendMsg and another goroutine calling
// recvMsg on the same stream at the same time.
// But it is not safe to call SendMsg on the same stream in different goroutines.
SendMsg(m interface{}) error
// RecvMsg blocks until it receives a message or the stream is
// done. On client side, it returns io.EOF when the stream is done. On
// any other error, it aborts the stream and returns an RPC status. On
// server side, it simply returns the error to the caller.
// It's safe to have a goroutine calling SendMsg and another goroutine calling
// recvMsg on the same stream at the same time.
// But it is not safe to call RecvMsg on the same stream in different goroutines.
RecvMsg(m interface{}) error
}
Stream defines the common interface a client or server stream has to satisfy.
type StreamDesc ¶
type StreamDesc struct {
Index uint8
StreamName string
Handler StreamHandler
ServerStreams bool
ClientStreams bool
}
type StreamHandler ¶
type StreamHandler func(srv interface{}, stream ServerStream) error
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
protoc-gen-yarpc
command
|
|
|
protoc-gen-yarpc/generator
The code generator for the plugin for the Google protocol buffer compiler.
|
The code generator for the plugin for the Google protocol buffer compiler. |
|
protoc-gen-yarpc/yarpc
Package yarpc outputs yarpc service descriptions in Go code.
|
Package yarpc outputs yarpc service descriptions in Go code. |
|
Package codes is a generated protocol buffer package.
|
Package codes is a generated protocol buffer package. |
|
Package status is a generated protocol buffer package.
|
Package status is a generated protocol buffer package. |
|
test
|
|
|
foo
Package foo is a generated protocol buffer package.
|
Package foo is a generated protocol buffer package. |
|
Package yarpcproto is a generated protocol buffer package.
|
Package yarpcproto is a generated protocol buffer package. |
Click to show internal directories.
Click to hide internal directories.