grpc

package
v1.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

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 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 New

func New(opts ...Option) *Client

New creates, configures via options and returns new Client instance.

func (*Client) Conn added in v1.27.0

func (c *Client) Conn() io.Closer

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 Message

type Message interface{}

Message represents raw gRPC message.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL