Documentation
¶
Overview ¶
Package client contains RPC client functions and structs.
Index ¶
- Constants
- Variables
- func IsNodeHostPartitioned(nh *dragonboat.NodeHost) bool
- type Connection
- type DrummerClient
- type NodeHostClient
- type Pool
- func (p *Pool) Close()
- func (p *Pool) GetConnection(ctx context.Context, addr string, tlsConfig *tls.Config) (*Connection, error)
- func (p *Pool) GetInsecureConnection(ctx context.Context, addr string) (*Connection, error)
- func (p *Pool) GetTLSConnection(ctx context.Context, addr string, caFile string, certFile string, ...) (*Connection, error)
- func (p *Pool) SetAddDialOptionsFunc(f addDialOptionsFunc)
Constants ¶
const ( // DefaultRegion is the default region name used in drummer monkey tests DefaultRegion string = "default-region" )
Variables ¶
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 )
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) 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.
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 NewDrummerConnectionPool ¶
func NewDrummerConnectionPool() *Pool
NewDrummerConnectionPool returns a gRPC connection pool with all connections configured for use with Drummer servers.
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 ¶
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.