client

package
v3.0.0-...-c8eabd8 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package client contains RPC client functions and structs.

Index

Constants

View Source
const (
	// DefaultRegion is the default region name used in drummer monkey tests
	DefaultRegion string = "default-region"
)

Variables

View Source
var (
	// HardWorkerTestShardID is the cluster ID of the cluster targeted by the
	// hard worker.
	HardWorkerTestShardID uint64 = 1
	// DrummerClientName is the name of the default master client.
	DrummerClientName = settings.Soft.DrummerClientName
)
View Source
var (
	// NodeHostInfoReportSecond defines how often should the NodeHost info be
	// reported to drummer servers.
	NodeHostInfoReportSecond = settings.Soft.NodeHostInfoReportSecond
)

Functions

func IsNodeHostPartitioned

func IsNodeHostPartitioned(nh *dragonboat.NodeHost) bool

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

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 DrummerClient

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

DrummerClient is the client used to contact drummer servers.

func NewDrummerClient

func NewDrummerClient(nh *dragonboat.NodeHost) *DrummerClient

NewDrummerClient creates a new drummer client instance.

func (*DrummerClient) HandleMasterRequests

func (dc *DrummerClient) HandleMasterRequests(ctx context.Context) error

HandleMasterRequests handles requests made by master servers.

func (*DrummerClient) Name

func (dc *DrummerClient) Name() string

Name returns the name of the drummer client.

func (*DrummerClient) SendNodeHostInfo

func (dc *DrummerClient) SendNodeHostInfo(ctx context.Context,
	drummerAPIAddress string,
	nhi dragonboat.NodeHostInfo,
	APIAddress string, logInfoIncluded bool) error

SendNodeHostInfo send the node host info the specified drummer server.

func (*DrummerClient) Stop

func (dc *DrummerClient) Stop()

Stop stops the drummer client.

type NodeHostClient

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

NodeHostClient is a NodeHost drummer client.

func NewNodeHostClient

func NewNodeHostClient(nh *dragonboat.NodeHost,
	drummerServers []string, apiAddress string) *NodeHostClient

NewNodeHostClient creates and returns a new NodeHostClient instance.

func (*NodeHostClient) Stop

func (dnh *NodeHostClient) Stop()

Stop stops the NodeHostClient instance.

func (*NodeHostClient) StopNodeHostInfoReporter

func (dnh *NodeHostClient) StopNodeHostInfoReporter()

StopNodeHostInfoReporter stop the info reporter part of the client.

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