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

doc(bigtable): deprecate RowReader public ctors #8887

Merged
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ background threads.
For status on this, see https://github.com/googleapis/google-cloud-cpp/issues/8800
</details>

<details>
<summary>2023-05-01: remove `bigtable::RowReader` constructors</summary>
<br>
On 2023-05-01 (or shortly after) we will remove `bigtable::RowReader`
constructors which accept `DataClient` as an argument.

Application developers that read rows by directly constructing a `RowReader`
object should instead construct a `Table` object and call `Table::ReadRows(...)`
on it.

For status on this, see https://github.com/googleapis/google-cloud-cpp/issues/8854
</details>

## v1.41.0 - TBD

## v1.40.0 - 2022-05
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/bigtable/row_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ RowReader::RowReader(
std::move(retry_policy), std::move(backoff_policy),
std::move(metadata_update_policy), std::move(parser_factory))) {}

std::int64_t constexpr RowReader::NO_ROWS_LIMIT;

// The name must be all lowercase to work with range-for loops.
RowReader::iterator RowReader::begin() {
return bigtable_internal::RowReaderIterator(impl_);
Expand Down
23 changes: 23 additions & 0 deletions google/cloud/bigtable/row_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ namespace google {
namespace cloud {
namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
class RowReader;
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable
namespace bigtable_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
bigtable::RowReader MakeRowReader(std::shared_ptr<RowReaderImpl> impl);
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
namespace bigtable {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/**
* Object returned by Table::ReadRows(), enumerates rows in the response.
Expand All @@ -51,13 +61,15 @@ class RowReader {
// NOLINTNEXTLINE(readability-identifier-naming)
static std::int64_t constexpr NO_ROWS_LIMIT = 0;

GOOGLE_CLOUD_CPP_BIGTABLE_ROW_READER_CTOR_DEPRECATED()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this change, the lack of default constructor is annoying. It makes it impossible to write code like this:

RowReader reader;
if (condition) {
  reader = table.ReadRows(...);
} else {
  reader = table.ReadRows(... /* but slightly different dots */);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #8892

RowReader(std::shared_ptr<DataClient> client, std::string table_name,
RowSet row_set, std::int64_t rows_limit, Filter filter,
std::unique_ptr<RPCRetryPolicy> retry_policy,
std::unique_ptr<RPCBackoffPolicy> backoff_policy,
MetadataUpdatePolicy metadata_update_policy,
std::unique_ptr<internal::ReadRowsParserFactory> parser_factory);

GOOGLE_CLOUD_CPP_BIGTABLE_ROW_READER_CTOR_DEPRECATED()
RowReader(std::shared_ptr<DataClient> client, std::string app_profile_id,
std::string table_name, RowSet row_set, std::int64_t rows_limit,
Filter filter, std::unique_ptr<RPCRetryPolicy> retry_policy,
Expand Down Expand Up @@ -98,6 +110,8 @@ class RowReader {
void Cancel();

private:
friend RowReader bigtable_internal::MakeRowReader(
std::shared_ptr<bigtable_internal::RowReaderImpl>);
explicit RowReader(std::shared_ptr<bigtable_internal::RowReaderImpl> impl)
: impl_(std::move(impl)) {}

Expand All @@ -106,6 +120,15 @@ class RowReader {

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable
namespace bigtable_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

inline bigtable::RowReader MakeRowReader(std::shared_ptr<RowReaderImpl> impl) {
return bigtable::RowReader(std::move(impl));
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
} // namespace cloud
} // namespace google

Expand Down
Loading