option

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package option contains common code for dealing with client options.

Index

Constants

View Source
const (
	// LoadBalancingStrategyEnvVar is the environment variable to control the gRPC load balancing strategy.
	LoadBalancingStrategyEnvVar = "CBT_LOAD_BALANCING_STRATEGY"
	// RoundRobinLBPolicy is the policy name for round-robin.
	RoundRobinLBPolicy = "round_robin"
	// LeastInFlightLBPolicy is the policy name for least in flight (custom).
	LeastInFlightLBPolicy = "least_in_flight"
	// PowerOfTwoLeastInFlightLBPolicy is the policy name for power of two least in flight (custom).
	PowerOfTwoLeastInFlightLBPolicy = "power_of_two_least_in_flight"
	// BigtableConnectionPoolEnvVar is the env var for enabling Bigtable Connection Pool.
	BigtableConnectionPoolEnvVar = "CBT_BIGTABLE_CONN_POOL"
)

Variables

This section is empty.

Functions

func ClientInterceptorOptions added in v1.2.0

func ClientInterceptorOptions(stream []grpc.StreamClientInterceptor, unary []grpc.UnaryClientInterceptor) []option.ClientOption

ClientInterceptorOptions returns client options to use for the client's gRPC connection, using the given streaming and unary RPC interceptors.

The passed interceptors are applied after internal interceptors which inject Google client information into the gRPC context.

func DefaultClientOptions

func DefaultClientOptions(endpoint, mtlsEndpoint, scope, userAgent string) ([]option.ClientOption, error)

DefaultClientOptions returns the default client options to use for the client's gRPC connection.

func EnableBigtableConnectionPool added in v1.41.0

func EnableBigtableConnectionPool() bool

EnableBigtableConnectionPool uses new conn pool if envVar is set.

Types

type LoadBalancingStrategy added in v1.41.0

type LoadBalancingStrategy int

LoadBalancingStrategy for connection pool.

const (
	// RoundRobin is the round_robin gRPC load balancing policy.
	RoundRobin LoadBalancingStrategy = iota
	// LeastInFlight is the least_in_flight gRPC load balancing policy (custom).
	LeastInFlight
	// PowerOfTwoLeastInFlight is the power_of_two_least_in_flight gRPC load balancing policy (custom).
	PowerOfTwoLeastInFlight
)

func BigtableLoadBalancingStrategy added in v1.41.0

func BigtableLoadBalancingStrategy() LoadBalancingStrategy

BigtableLoadBalancingStrategy returns the gRPC service config JSON string for the chosen policy.

func (LoadBalancingStrategy) String added in v1.41.0

func (s LoadBalancingStrategy) String() string

String returns the string representation of the LoadBalancingStrategy.

Jump to

Keyboard shortcuts

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