neofsgrpc

package
v1.25.1-0...-2fdc35d Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

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

func (x Client) Close() error

Close closes opened connection.

Must be called only after successful initialization.

func (Client) RPC

func (x Client) RPC(ctx context.Context, prm RPCPrm, res *RPCRes) error

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

func (x DialPrm) Dial(res *DialRes) error

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

func (x *DialPrm) SetAddress(addr string)

SetAddress sets network address as a connection target.

func (*DialPrm) SetTLSConfig

func (x *DialPrm) SetTLSConfig(c *tls.Config)

SetTLSConfig sets TLS client configuration.

func (*DialPrm) SetTimeout

func (x *DialPrm) SetTimeout(timeout time.Duration)

SetTimeout sets timeout for dialing.

type DialRes

type DialRes struct {
	// contains filtered or unexported fields
}

DialPrm groups the Dial results.

func (DialRes) Client

func (x DialRes) Client() Client

Client returns initialized Client instance.

Should be called only after successful Dial.

type Message

type Message interface{}

Message represents raw gRPC message.

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.

Jump to

Keyboard shortcuts

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