Documentation ¶
Index ¶
- Variables
- func Codec() grpc.Codec
- func CodecWithParent(fallback grpc.Codec) grpc.Codec
- func SetupConnOptions(opts []nats.Option) []nats.Option
- type Client
- func (p *Client) Close() error
- func (p *Client) CloseStream(nid string) bool
- func (c *Client) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, ...) error
- func (c *Client) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, ...) (grpc.ClientStream, error)
- type Frame
- type NatsConn
- type RawCodec
- type Server
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIllegalHeaderWrite indicates that setting header is illegal because of // the stream's state. ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") )
Functions ¶
func Codec ¶
Codec returns a proxying grpc.Codec with the default protobuf codec as parent.
See CodecWithParent.
func CodecWithParent ¶
CodecWithParent returns a proxying grpc.Codec with a user provided codec as parent.
This codec is *crucial* to the functioning of the proxy. It allows the proxy server to be oblivious to the schema of the forwarded messages. It basically treats a gRPC message frame as raw bytes. However, if the server handler, or the client caller are not proxy-internal functions it will fall back to trying to decode the message using a fallback codec.
func SetupConnOptions ¶
func SetupConnOptions(opts []nats.Option) []nats.Option
SetupConnOptions default conn opts.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CloseStream ¶
func (*Client) Invoke ¶
func (c *Client) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error
Invoke performs a unary RPC and returns after the request is received into reply.
func (*Client) NewStream ¶
func (c *Client) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)
NewStream begins a streaming RPC.
type NatsConn ¶
type NatsConn interface { Publish(subj string, data []byte) error PublishRequest(subj, reply string, data []byte) error Request(subj string, data []byte, timeout time.Duration) (*nats.Msg, error) ChanSubscribe(subj string, ch chan *nats.Msg) (*nats.Subscription, error) SubscribeSync(subj string) (*nats.Subscription, error) QueueSubscribe(subj, queue string, cb nats.MsgHandler) (*nats.Subscription, error) LastError() error Flush() error }
NatsConn nats connection.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the interface to gRPC over NATS
func NewServer ¶
func NewServer(nc NatsConn, nid string, options ...ServerOption) *Server
NewServer creates a new Proxy
func (*Server) CloseStream ¶
func (*Server) GetServiceInfo ¶
func (s *Server) GetServiceInfo() map[string]grpc.ServiceInfo
func (*Server) RegisterService ¶
func (s *Server) RegisterService(sd *grpc.ServiceDesc, ss interface{})
RegisterService is used to register gRPC services
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
A ServerOption sets options such as credentials, codec and keepalive parameters, etc.
func ChainStreamInterceptor ¶
func ChainStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) ServerOption
ChainStreamInterceptor returns a ServerOption that specifies the chained interceptor for streaming RPCs. The first interceptor will be the outer most, while the last interceptor will be the inner most wrapper around the real call. All stream interceptors added by this method will be chained.
func ChainUnaryInterceptor ¶
func ChainUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) ServerOption
ChainUnaryInterceptor returns a ServerOption that specifies the chained interceptor for unary RPCs. The first interceptor will be the outer most, while the last interceptor will be the inner most wrapper around the real call. All unary interceptors added by this method will be chained.
Directories ¶
Path | Synopsis |
---|---|
Package reflection implements server reflection service.
|
Package reflection implements server reflection service. |