client

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package client contains RPC client functions and structs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DrummerClientName is the name of the default master client.
	DrummerClientName = settings.Soft.DrummerClientName
)

Functions

func IsNodeHostPartitioned

func IsNodeHostPartitioned(nh *dragonboat.NodeHost) bool

IsNodeHostPartitioned returns a boolean value indicating whether NodeHost is in the partitioned test mode.

func NewDrummerClient

func NewDrummerClient(nh *dragonboat.NodeHost) dragonboat.IMasterClient

NewDrummerClient creates a new drummer client instance.

Types

type Connection

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

Connection is a gRPC client connection.

func (*Connection) ClientConn

func (c *Connection) ClientConn() *grpc.ClientConn

ClientConn returns the gRPC client connection.

func (*Connection) Close

func (c *Connection) Close()

Close closes the connection.

func (*Connection) IsClosed

func (c *Connection) IsClosed() bool

IsClosed returns whether the connection has been closed or not.

type Pool

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

Pool manages a pool of gRPC client connections keyed by their destination addresses.

func NewConnectionPool

func NewConnectionPool() *Pool

NewConnectionPool creates a new object.

func NewDrummerConnectionPool

func NewDrummerConnectionPool() *Pool

NewDrummerConnectionPool returns a gRPC connection pool with all connections configured for use with Drummer servers.

func (*Pool) Close

func (p *Pool) Close()

Close closes all connections in the pool.

func (*Pool) GetConnection

func (p *Pool) GetConnection(ctx context.Context, addr string,
	tlsConfig *tls.Config) (*Connection, error)

GetConnection tries to get a connection based on the specified TLS config. The specified tlsConfig should be configured to use TLS mutual authentication or it should be nil for using insecure connection.

func (*Pool) GetInsecureConnection

func (p *Pool) GetInsecureConnection(ctx context.Context,
	addr string) (*Connection, error)

GetInsecureConnection returns an insecure Connection instance connected to the specified grpc server. It is recommended to use TLS connection for secured communication.

func (*Pool) GetTLSConnection

func (p *Pool) GetTLSConnection(ctx context.Context, addr string,
	caFile string, certFile string, keyFile string) (*Connection, error)

GetTLSConnection returns an TLS connection connected to the specified grpc server.

func (*Pool) SetAddDialOptionsFunc

func (p *Pool) SetAddDialOptionsFunc(f addDialOptionsFunc)

SetAddDialOptionsFunc sets the func used for adding extra connection options.

Jump to

Keyboard shortcuts

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