Client Config and Dial
GitHub source:
The SDK entry point is client.Dial(ctx, cfg).
Core Types
client.Configclient.Client
What Dial Does
Dial(...) is not just a raw TCP connect. It:
- applies config defaults
- validates that bootstrap endpoints exist
- creates the transport client
- performs metadata bootstrap
- starts background metadata refresh behavior for long-lived clients
That means a successful Dial(...) is already a stronger signal than “socket open”.
Key Config Fields
Connection and Bootstrap
Endpoints- required bootstrap addresses
DialTimeoutRequestTimeoutBootstrapBackoffInitialBootstrapBackoffMaxBootstrapMaxAttempts
Metadata and Routing
MetadataRefreshTimeoutMetadataRefreshIntervalEndpointCooldownPreferredListenerName
Client Identity and Hooks
ClientSoftwareNameClientSoftwareVersionAuthenticatorDialer
Snapshot-Related Settings
SnapshotStorageSnapshotFetcher
Common Call Pattern
ctx := context.Background()
cli, err := client.Dial(ctx, client.Config{
Endpoints: []string{"127.0.0.1:9123"},
})
if err != nil {
log.Fatal(err)
}
defer cli.Close()
What You Get Back
Dial(...) returns a *client.Client. The main next-step methods are:
Admin()Table(path)RefreshMetadata(...)Close()
When to Customize Config
Use defaults first unless you have a clear reason to tune:
- backoff and timeout behavior
- listener selection in multi-network environments
- custom auth hooks
- snapshot storage or custom snapshot fetching
Important Caveats
Endpointsis required.- Metadata-advertised coordinator and tablet addresses must also be reachable after bootstrap.
SnapshotStorageis only needed for the current snapshot-fetch path, not for ordinary admin or table operations.
Positioning
This page is a curated reference page, not generated godoc. It should stay focused on how callers actually use the SDK, not on reprinting every implementation detail.