package option

import "cloud.google.com/go/bigtable/internal/option"

Package option contains common code for dealing with client options.

Index

Constants

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"
)

Functions

func ClientInterceptorOptions

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

func EnableBigtableConnectionPool() bool

EnableBigtableConnectionPool uses new conn pool if envVar is set.

Types

type LoadBalancingStrategy

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

func BigtableLoadBalancingStrategy() LoadBalancingStrategy

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

func (LoadBalancingStrategy) String

func (s LoadBalancingStrategy) String() string

String returns the string representation of the LoadBalancingStrategy.

Source Files

option.go

Version
v1.41.0 (latest)
Published
Dec 15, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
4 months ago

Tools for package owners.