client

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DialTimeout    = 5 * time.Second
	RequestTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetServerInfo returns the basic server infos of the cluster.
	GetServerInfo() ([]string, error)
	// SendRequest sends a rpc request to the server.
	SendRequest(ctx context.Context, address string, req *hstreamrpc.Request) (*hstreamrpc.Response, error)
	// Close closes the client.
	Close()
}

Client is a client that sends RPC to HStreamDB server. It should not be used after calling Close().

type RPCClient added in v0.1.1

type RPCClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

RPCClient will send rpc requests to HStreamDB server.

func NewRPCClient added in v0.1.1

func NewRPCClient(address string, tlsCfg security.TLSAuth) (*RPCClient, error)

NewRPCClient TODO:use connection pool for each address

func (*RPCClient) Close added in v0.1.1

func (c *RPCClient) Close()

func (*RPCClient) GetServerInfo added in v0.1.1

func (c *RPCClient) GetServerInfo() ([]string, error)

GetServerInfo returns cached server info

func (*RPCClient) SendRequest added in v0.1.1

func (c *RPCClient) SendRequest(ctx context.Context, address string, req *hstreamrpc.Request) (*hstreamrpc.Response, error)

SendRequest sends a hstreamrpc.Request to the specified server.

Jump to

Keyboard shortcuts

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