Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption func(*callParameters)
CallOption is a messaging session option within RPC.
func AllowBinarySendingOnly ¶
func AllowBinarySendingOnly() CallOption
AllowBinarySendingOnly allows to pass []byte argument only to [MessageReadWriter.WriteMessage] method. By default, only proto.Message instances may be used. Use this option when binary message transmission is needed. Note that only proto.Message response messages are supported even with this option.
func WithContext ¶
func WithContext(ctx context.Context) CallOption
WithContext returns option to set RPC context.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents client for exchanging messages with a remote server using gRPC protocol.
func (*Client) Conn ¶
Conn returns underlying connection.
Conn is NPE-safe: returns nil if Client is nil.
Client should not be used after Close() call on the connection: behavior is undefined.
func (*Client) Init ¶
func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error)
Init initiates a messaging session within the RPC configured by options.
type MessageReadWriter ¶
type MessageReadWriter interface { // ReadMessage reads the next message from the remote server, // and writes it to the argument. ReadMessage(Message) error // WriteMessage sends message from argument to remote server. WriteMessage(Message) error // Closes the communication session with the remote server. // // All calls to send/receive messages must be done before closing. io.Closer }
MessageReadWriter is a component interface for transmitting raw messages over gRPC protocol.
type Option ¶
type Option func(*cfg)
Option is a Client's constructor option.
func WithClientConnection ¶
func WithClientConnection(con *grpc.ClientConn) Option
WithClientConnection returns option to set gRPC connection to the remote server.
func WithRWTimeout ¶
WithRWTimeout returns option to specify rwTimeout for reading and writing single gRPC message.