Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(bigquery/storage/managedwriter): augment context usage in package docs #8334

Merged
merged 3 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bigquery/storage/managedwriter/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ type Client struct {
}

// NewClient instantiates a new client.
//
// The context provided here is retained and used for background connection management
// between the client and the BigQuery Storage service.
func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (c *Client, err error) {
// Set a reasonable default for the gRPC connection pool size.
numConns := runtime.GOMAXPROCS(0)
Expand Down
13 changes: 13 additions & 0 deletions bigquery/storage/managedwriter/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ In support of the retry changes, the AppendResult returned as part of an append
TotalAttempts(), which returns the number of times that specific append was enqueued to the service.
Values larger than 1 are indicative of a specific append being enqueued multiple times.

# Usage of Contexts

The underlying rpc mechanism used to transmit requests and responses between this client and
the service uses a gRPC bidirectional streaming protocol, and the context provided when invoking
NewClient to instantiate the client is used to maintain those background connections.

This package also exposes context when instantiating a new writer (NewManagedStream), as well as
allowing a per-request context when invoking the AppendRows function to send a set of rows. If the
context becomes invalid on the writer all subsequent AppendRows requests will be blocked.

Finally, there is a per-request context supplied as part of the AppendRows call on the ManagedStream
writer itself, useful for bounding individual requests.

# Connection Sharing (Multiplexing)

Note: This feature is EXPERIMENTAL and subject to change.
Expand Down