Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents client for exchanging messages with a remote server using gRPC protocol.
Should be created using DialPrm.Dial.
Client is one-time use, and should only be used within an open connection.
func (Client) Close ¶
Close closes opened connection.
Must be called only after successful initialization.
func (Client) RPC ¶
RPC initiates a messaging session within the parameterized RPC. Underlying connection must be initialized before.
Context is used for message exchange. Timeout can be configured using context.WithTimeout.
If there is no error, res.Messager() can be used for communication. It should be closed finally.
Panics if ctx or res is nil, CallMethodInfo has empty service or method name.
type DialPrm ¶
type DialPrm struct {
// contains filtered or unexported fields
}
DialPrm groups the Dial parameters.
func (DialPrm) Dial ¶
Dial opens client connection and initializes Client with it.
Blocks until successful connection or timeout. If TLS is configured, connection is opened using it.
DialRes must not be nil. Client can be received using res.Client().
func (*DialPrm) SetAddress ¶
SetAddress sets network address as a connection target.
func (*DialPrm) SetTLSConfig ¶
SetTLSConfig sets TLS client configuration.
func (*DialPrm) SetTimeout ¶
SetTimeout sets timeout for dialing.
type DialRes ¶
type DialRes struct {
// contains filtered or unexported fields
}
DialPrm groups the Dial results.
type MessageReadWriter ¶
type MessageReadWriter struct {
// contains filtered or unexported fields
}
MessageReadWriter is a component for transmitting raw messages over gRPC protocol.
func (MessageReadWriter) CloseSend ¶
func (w MessageReadWriter) CloseSend() error
CloseSend ends writing messages to the server.
All WriteMessage calls should be done before closing.
func (MessageReadWriter) ReadMessage ¶
func (w MessageReadWriter) ReadMessage(m Message) error
ReadMessage reads the next message from the remote server, and writes it to the Message.
func (MessageReadWriter) WriteMessage ¶
func (w MessageReadWriter) WriteMessage(m Message) error
WriteMessage sends Message to the remote server.
Should not be called after the CloseSend.
type RPCPrm ¶
type RPCPrm struct {
// contains filtered or unexported fields
}
RPCPrm groups the parameters of Client.RPC call.
func (*RPCPrm) SetCallMethodInfo ¶
func (x *RPCPrm) SetCallMethodInfo(mInfo common.CallMethodInfo)
SetCallMethodInfo sets information about the RPC service and method.
Required parameter, service and names must not be empty.
type RPCRes ¶
type RPCRes struct {
// contains filtered or unexported fields
}
RPCRes groups the results of Client.RPC call.
func (RPCRes) Messager ¶
func (x RPCRes) Messager() MessageReadWriter
Messager returns initialized MessageReadWriter which can be used for message exchange.
Should be called only after successful Client.RPC call. MessageReadWriter should be closed after communication is completed.