From 1de52d93d9c4830248d7c415c08d6e94ea38fa91 Mon Sep 17 00:00:00 2001 From: Dorna Raj Gyawali Date: Mon, 7 Jul 2025 03:41:39 +0000 Subject: [PATCH 1/3] feat(bigtable): add Clear(std::string&) helper for RowKeyType compatibility Adds a Clear(std::string&) function that calls std::string::clear() in OSS builds. This unifies the interface for clearing row keys between OSS (std::string) and Google internal (absl::Cord), where an overload will call absl::Cord::Clear() instead of deprecated clear(). Signed-off-by: Dronaraj Gyawali --- google/cloud/bigtable/internal/google_bytes_traits.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/google/cloud/bigtable/internal/google_bytes_traits.h b/google/cloud/bigtable/internal/google_bytes_traits.h index 93da29fffdce4..7685acc37535d 100644 --- a/google/cloud/bigtable/internal/google_bytes_traits.h +++ b/google/cloud/bigtable/internal/google_bytes_traits.h @@ -38,6 +38,9 @@ namespace internal { /// Return true if the row key is empty. inline bool IsEmptyRowKey(std::string const& key) { return key.empty(); } +/// Clear the row key. +inline void Clear(std::string& key) { key.clear(); } + /// Return true if the row key is empty. inline bool IsEmptyRowKey(char const* key) { return std::string{} == key; } From d6cdb47887d8aa7f94b35b961f0a39c75b1265e1 Mon Sep 17 00:00:00 2001 From: Dorna Raj Gyawali Date: Tue, 8 Jul 2025 02:53:48 +0000 Subject: [PATCH 2/3] feat(bigtable): place the code after IsEmptyRowKey() --- google/cloud/bigtable/internal/google_bytes_traits.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google/cloud/bigtable/internal/google_bytes_traits.h b/google/cloud/bigtable/internal/google_bytes_traits.h index 7685acc37535d..7ceb2aee1c3d1 100644 --- a/google/cloud/bigtable/internal/google_bytes_traits.h +++ b/google/cloud/bigtable/internal/google_bytes_traits.h @@ -38,12 +38,12 @@ namespace internal { /// Return true if the row key is empty. inline bool IsEmptyRowKey(std::string const& key) { return key.empty(); } -/// Clear the row key. -inline void Clear(std::string& key) { key.clear(); } - /// Return true if the row key is empty. inline bool IsEmptyRowKey(char const* key) { return std::string{} == key; } +/// Clear the row key. +inline void Clear(std::string& key) { key.clear(); } + #if GOOGLE_CLOUD_CPP_CPP_VERSION >= 201703L /// Return true if the row key is empty. inline bool IsEmptyRowKey(std::string_view key) { return key.empty(); } From 78b644c3ea516f472a58dbbbc2b7b78ba9d3b445 Mon Sep 17 00:00:00 2001 From: Dorna Raj Gyawali Date: Tue, 8 Jul 2025 04:17:56 +0000 Subject: [PATCH 3/3] feat(bigtable):replace the code placement Signed-off-by: Dorna Raj Gyawali --- google/cloud/bigtable/internal/google_bytes_traits.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google/cloud/bigtable/internal/google_bytes_traits.h b/google/cloud/bigtable/internal/google_bytes_traits.h index 7ceb2aee1c3d1..354402c1cd6dc 100644 --- a/google/cloud/bigtable/internal/google_bytes_traits.h +++ b/google/cloud/bigtable/internal/google_bytes_traits.h @@ -41,14 +41,14 @@ inline bool IsEmptyRowKey(std::string const& key) { return key.empty(); } /// Return true if the row key is empty. inline bool IsEmptyRowKey(char const* key) { return std::string{} == key; } -/// Clear the row key. -inline void Clear(std::string& key) { key.clear(); } - #if GOOGLE_CLOUD_CPP_CPP_VERSION >= 201703L /// Return true if the row key is empty. inline bool IsEmptyRowKey(std::string_view key) { return key.empty(); } #endif // GOOGLE_CLOUD_CPP_CPP_VERSION >= 201703L +/// Clear the row key. +inline void Clear(std::string& key) { key.clear(); } + /// Return `< 0` if `lhs < rhs`, 0 if `lhs == rhs`, and `> 0' otherwise. inline int CompareRowKey(std::string const& lhs, std::string const& rhs) { return lhs.compare(rhs);