Google Cloud BigQuery C++ Client 2.11.0
A C++ Client Library for Google Cloud BigQuery
Loading...
Searching...
No Matches
bigquery_write_connection.h
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Generated by the Codegen C++ plugin.
16// If you make any local changes, they will be lost.
17// source: google/cloud/bigquery/storage/v1/storage.proto
18
19#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_STORAGE_V1_BIGQUERY_WRITE_CONNECTION_H
20#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_STORAGE_V1_BIGQUERY_WRITE_CONNECTION_H
21
22#include "google/cloud/bigquery/storage/v1/bigquery_write_connection_idempotency_policy.h"
23#include "google/cloud/bigquery/storage/v1/internal/bigquery_write_retry_traits.h"
24#include "google/cloud/backoff_policy.h"
25#include "google/cloud/internal/async_read_write_stream_impl.h"
26#include "google/cloud/options.h"
27#include "google/cloud/status_or.h"
28#include "google/cloud/version.h"
29#include <google/cloud/bigquery/storage/v1/storage.pb.h>
30#include <memory>
31
32namespace google {
33namespace cloud {
34namespace bigquery_storage_v1 {
35GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
36
37using BigQueryWriteRetryPolicy =
38 ::google::cloud::internal::TraitBasedRetryPolicy<
39 bigquery_storage_v1_internal::BigQueryWriteRetryTraits>;
40
41using BigQueryWriteLimitedTimeRetryPolicy =
42 ::google::cloud::internal::LimitedTimeRetryPolicy<
43 bigquery_storage_v1_internal::BigQueryWriteRetryTraits>;
44
45using BigQueryWriteLimitedErrorCountRetryPolicy =
46 ::google::cloud::internal::LimitedErrorCountRetryPolicy<
47 bigquery_storage_v1_internal::BigQueryWriteRetryTraits>;
48
49/**
50 * The `BigQueryWriteConnection` object for `BigQueryWriteClient`.
51 *
52 * This interface defines virtual methods for each of the user-facing overload
53 * sets in `BigQueryWriteClient`. This allows users to inject custom behavior
54 * (e.g., with a Google Mock object) when writing tests that use objects of type
55 * `BigQueryWriteClient`.
56 *
57 * To create a concrete instance, see `MakeBigQueryWriteConnection()`.
58 *
59 * For mocking, see `bigquery_storage_v1_mocks::MockBigQueryWriteConnection`.
60 */
62 public:
63 virtual ~BigQueryWriteConnection() = 0;
64
65 virtual Options options() { return Options{}; }
66
67 virtual StatusOr<google::cloud::bigquery::storage::v1::WriteStream>
69 google::cloud::bigquery::storage::v1::CreateWriteStreamRequest const&
70 request);
71
72 virtual std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
73 google::cloud::bigquery::storage::v1::AppendRowsRequest,
74 google::cloud::bigquery::storage::v1::AppendRowsResponse>>
76
77 virtual StatusOr<google::cloud::bigquery::storage::v1::WriteStream>
79 google::cloud::bigquery::storage::v1::GetWriteStreamRequest const&
80 request);
81
82 virtual StatusOr<
83 google::cloud::bigquery::storage::v1::FinalizeWriteStreamResponse>
85 google::cloud::bigquery::storage::v1::FinalizeWriteStreamRequest const&
86 request);
87
88 virtual StatusOr<
89 google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsResponse>
91 BatchCommitWriteStreamsRequest const& request);
92
93 virtual StatusOr<google::cloud::bigquery::storage::v1::FlushRowsResponse>
95 google::cloud::bigquery::storage::v1::FlushRowsRequest const& request);
96};
97
98/**
99 * A factory function to construct an object of type `BigQueryWriteConnection`.
100 *
101 * The returned connection object should not be used directly; instead it
102 * should be passed as an argument to the constructor of BigQueryWriteClient.
103 *
104 * The optional @p options argument may be used to configure aspects of the
105 * returned `BigQueryWriteConnection`. Expected options are any of the types in
106 * the following option lists:
107 *
108 * - `google::cloud::CommonOptionList`
109 * - `google::cloud::GrpcOptionList`
110 * - `google::cloud::UnifiedCredentialsOptionList`
111 * - `google::cloud::bigquery_storage_v1::BigQueryWritePolicyOptionList`
112 *
113 * @note Unexpected options will be ignored. To log unexpected options instead,
114 * set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment.
115 *
116 * @param options (optional) Configure the `BigQueryWriteConnection` created by
117 * this function.
118 */
120 Options options = {});
121
122GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
123} // namespace bigquery_storage_v1
124} // namespace cloud
125} // namespace google
126
127#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_STORAGE_V1_BIGQUERY_WRITE_CONNECTION_H
The BigQueryWriteConnection object for BigQueryWriteClient.
Definition: bigquery_write_connection.h:61
virtual StatusOr< google::cloud::bigquery::storage::v1::WriteStream > CreateWriteStream(google::cloud::bigquery::storage::v1::CreateWriteStreamRequest const &request)
virtual StatusOr< google::cloud::bigquery::storage::v1::FlushRowsResponse > FlushRows(google::cloud::bigquery::storage::v1::FlushRowsRequest const &request)
virtual Options options()
Definition: bigquery_write_connection.h:65
virtual StatusOr< google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsResponse > BatchCommitWriteStreams(google::cloud::bigquery::storage::v1::BatchCommitWriteStreamsRequest const &request)
virtual std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc< google::cloud::bigquery::storage::v1::AppendRowsRequest, google::cloud::bigquery::storage::v1::AppendRowsResponse > > AsyncAppendRows()
virtual StatusOr< google::cloud::bigquery::storage::v1::FinalizeWriteStreamResponse > FinalizeWriteStream(google::cloud::bigquery::storage::v1::FinalizeWriteStreamRequest const &request)
virtual StatusOr< google::cloud::bigquery::storage::v1::WriteStream > GetWriteStream(google::cloud::bigquery::storage::v1::GetWriteStreamRequest const &request)
Definition: bigquery_read_client.h:32
std::shared_ptr< BigQueryWriteConnection > MakeBigQueryWriteConnection(Options options={})
A factory function to construct an object of type BigQueryWriteConnection.
Definition: analytics_hub_client.h:30