Documentation ¶
Index ¶
- func IsConnCanceled(err error) bool
- type Client
- func (c *Client) ActiveConnection() *grpc.ClientConn
- func (c *Client) Close() error
- func (c *Client) Ctx() context.Context
- func (c *Client) Dial(ep string) (*grpc.ClientConn, error)
- func (c *Client) Endpoints() []string
- func (c *Client) GetCallOpts() []grpc.CallOption
- func (c *Client) SetEndpoints(eps []string)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConnCanceled ¶
IsConnCanceled returns true, if error is from a closed gRPC connection. ref. https://github.com/grpc/grpc-go/pull/1854
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides and manages an etcd v3 client session.
func (*Client) ActiveConnection ¶
func (c *Client) ActiveConnection() *grpc.ClientConn
ActiveConnection returns the current in-use connection
func (*Client) Ctx ¶
Ctx is a context for "out of band" messages (e.g., for sending "clean up" message when another context is canceled). It is canceled on client Close().
func (*Client) Dial ¶
func (c *Client) Dial(ep string) (*grpc.ClientConn, error)
Dial connects to a single endpoint using the client's config.
func (*Client) GetCallOpts ¶
func (c *Client) GetCallOpts() []grpc.CallOption
func (*Client) SetEndpoints ¶
SetEndpoints updates client's endpoints.
type Config ¶
type Config struct { // Endpoints is a list of URLs. Endpoints []string // Endpoints address attributes // see: https://github.com/grpc/grpc-go/blob/v1.36.0/attributes/attributes.go#L30 Attributes map[string]*attributes.Attributes // load balance name, current support balancer.RoundRobinBalanceName, balancer.WeightedRobinBalanceName BalanceName string // AutoSyncInterval is the interval to update endpoints with its latest members. // 0 disables auto-sync. By default auto-sync is disabled. AutoSyncInterval time.Duration // DialTimeout is the timeout for failing to establish a connection. DialTimeout time.Duration // DialKeepAliveTime is the time after which client pings the server to see if // transport is alive. DialKeepAliveTime time.Duration // DialKeepAliveTimeout is the time that the client waits for a response for the // keep-alive probe. If the response is not received in this time, the connection is closed. DialKeepAliveTimeout time.Duration // MaxCallSendMsgSize is the client-side request send limit in bytes. // If 0, it defaults to 2.0 MiB (2 * 1024 * 1024). // Make sure that "MaxCallSendMsgSize" < server-side default send/recv limit. // ("--max-request-bytes" flag to etcd or "embed.Config.MaxRequestBytes"). MaxCallSendMsgSize int // MaxCallRecvMsgSize is the client-side response receive limit. // If 0, it defaults to "math.MaxInt32", because range response can // easily exceed request send limits. // Make sure that "MaxCallRecvMsgSize" >= server-side default send/recv limit. // ("--max-request-bytes" flag to etcd or "embed.Config.MaxRequestBytes"). MaxCallRecvMsgSize int // DialOptions is a list of dial options for the grpc client (e.g., for interceptors). // For example, pass "grpc.WithBlock()" to block until the underlying connection is up. // Without this, Dial returns immediately and connecting the server happens in background. DialOptions []grpc.DialOption // Context is the default client context; it can be used to cancel grpc dial out and // other operations that do not have an explicit context. Context context.Context PermitWithoutStream bool }
Click to show internal directories.
Click to hide internal directories.