Documentation ¶
Overview ¶
Package client contains RPC client functions and structs.
Index ¶
- Variables
- func IsNodeHostPartitioned(nh *dragonboat.NodeHost) bool
- func NewDrummerClient(nh *dragonboat.NodeHost) dragonboat.IMasterClient
- type Connection
- 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 ¶
This section is empty.
Variables ¶
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) 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 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.