Skip to content

Commit

Permalink
cleanup(spanner): deprecate legacy Spanner admin interfaces (#7359)
Browse files Browse the repository at this point in the history
Start the one-year deprecation clock on the legacy, hand-written Spanner
admin interfaces.

Also bump the `disable_deprecation_warnings.inc` include-ordering priority.
In general, it needs to appear before any other inclusions.

See #7356.
  • Loading branch information
devbww authored Sep 25, 2021
1 parent 801f24a commit 721d690
Show file tree
Hide file tree
Showing 23 changed files with 65 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PointerAlignment: Left
IncludeBlocks: Merge
IncludeCategories:
# Matches common headers first, but sorts them after project includes
- Regex: '^\"google/cloud/internal/disable_deprecation_warnings.inc\"$'
Priority: -1
- Regex: '^\"google/cloud/(internal/|grpc_utils/|testing_util/|[^/]+\.h)'
Priority: 1000
- Regex: '^\"google/cloud/' # project includes should sort first
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@
the call site. See [#5929] for more details.
</details>

<details>
<summary>2022-10-01: retiring legacy Spanner admin APIs</summary>
<br>

* On 2022-10-01 (or shortly after) we are planning to remove the hand-written
versions of the Spanner admin APIs. These have been superseded by versions
generated automatically from the service definitions. The new APIs can be
found in the [`google/cloud/spanner/admin`](https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/spanner/admin)
tree and within the `google::cloud::spanner_admin` namespace. Starting with
the v1.32.0 release, and depending on your compiler settings, using these
classes/functions may elicit a deprecation warning. See
[#7356](https://github.com/googleapis/google-cloud-cpp/issues/7356) for more
details.
</details>

## v1.32.0 - TBD

### [Storage](https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/storage/README.md)
Expand Down
2 changes: 1 addition & 1 deletion ci/cloudbuild/builds/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ doc_args=(
"-DCMAKE_BUILD_TYPE=Debug"
"-DGOOGLE_CLOUD_CPP_GENERATE_DOXYGEN=ON"
"-DGOOGLE_CLOUD_CPP_GEN_DOCS_FOR_GOOGLEAPIS_DEV=ON"
"-DDOXYGEN_CLANG_OPTIONS=-resource-dir=$(clang -print-resource-dir)"
"-DDOXYGEN_CLANG_OPTIONS=-resource-dir=$(clang -print-resource-dir) -Wno-deprecated-declarations"
)

# Extract the version number if we're on a release branch.
Expand Down
1 change: 1 addition & 0 deletions cmake/GoogleCloudCppCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ elseif (GOOGLE_CLOUD_CPP_GENERATE_DOXYGEN)
"GOOGLE_CLOUD_CPP_DEPRECATED(x)="
"GOOGLE_CLOUD_CPP_IAM_DEPRECATED(x)="
"GOOGLE_CLOUD_CPP_BIGTABLE_IAM_DEPRECATED(x)="
"GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED(x)="
"GOOGLE_CLOUD_CPP_GENERATED_NS=v${PROJECT_VERSION_MAJOR}"
"GOOGLE_CLOUD_CPP_NS=v${PROJECT_VERSION_MAJOR}"
"GOOGLE_CLOUD_CPP_PUBSUB_NS=v${PROJECT_VERSION_MAJOR}"
Expand Down
2 changes: 2 additions & 0 deletions generator/integration_tests/golden/tests/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PointerAlignment: Left
IncludeBlocks: Merge
IncludeCategories:
# Matches common headers first, but sorts them after project includes
- Regex: '^\"google/cloud/internal/disable_deprecation_warnings.inc\"$'
Priority: -1
- Regex: '^\"google/cloud/(internal/|grpc_utils/|testing_util/|[^/]+\.h)'
Priority: 1000
- Regex: '^\"google/cloud/' # project includes should sort first
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/database_admin_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/database_admin_client.h"
#include "google/cloud/spanner/timestamp.h"
#include <algorithm>
Expand Down
3 changes: 2 additions & 1 deletion google/cloud/spanner/database_admin_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ inline namespace SPANNER_CLIENT_NS {
* [database-doc-link]:
* https://cloud.google.com/spanner/docs/schema-and-data-model
*/
class DatabaseAdminClient {
class GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("DatabaseAdminClient")
DatabaseAdminClient {
public:
explicit DatabaseAdminClient(
ConnectionOptions const& options = ConnectionOptions());
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/database_admin_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/database_admin_client.h"
#include "google/cloud/spanner/mocks/mock_database_admin_connection.h"
#include "google/cloud/spanner/timestamp.h"
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/database_admin_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/database_admin_connection.h"
#include "google/cloud/spanner/internal/defaults.h"
#include "google/cloud/spanner/options.h"
Expand Down
6 changes: 5 additions & 1 deletion google/cloud/spanner/database_admin_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ using ListBackupsRange = ::google::cloud::internal::PaginationRange<
* To create a concrete instance that connects you to a real Cloud Spanner
* instance administration service, see `MakeDatabaseAdminConnection()`.
*/
class DatabaseAdminConnection {
class GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("DatabaseAdminConnection")
DatabaseAdminConnection {
public:
virtual ~DatabaseAdminConnection() = 0;

Expand Down Expand Up @@ -341,6 +342,7 @@ class DatabaseAdminConnection {
* @param opts (optional) configure the `DatabaseAdminConnection` created by
* this function.
*/
GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("MakeDatabaseAdminConnection()")
std::shared_ptr<spanner::DatabaseAdminConnection> MakeDatabaseAdminConnection(
Options opts = {});

Expand All @@ -359,6 +361,7 @@ std::shared_ptr<spanner::DatabaseAdminConnection> MakeDatabaseAdminConnection(
* @param options configure the `DatabaseAdminConnection` created by this
* function.
*/
GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("MakeDatabaseAdminConnection()")
std::shared_ptr<DatabaseAdminConnection> MakeDatabaseAdminConnection(
ConnectionOptions const& options);

Expand All @@ -384,6 +387,7 @@ std::shared_ptr<DatabaseAdminConnection> MakeDatabaseAdminConnection(
* @par Example
* @snippet samples.cc custom-database-admin-policies
*/
GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("MakeDatabaseAdminConnection()")
std::shared_ptr<DatabaseAdminConnection> MakeDatabaseAdminConnection(
ConnectionOptions const& options, std::unique_ptr<RetryPolicy> retry_policy,
std::unique_ptr<BackoffPolicy> backoff_policy,
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/database_admin_connection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/database_admin_connection.h"
#include "google/cloud/spanner/internal/defaults.h"
#include "google/cloud/spanner/options.h"
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/instance_admin_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/instance_admin_client.h"

namespace google {
Expand Down
3 changes: 2 additions & 1 deletion google/cloud/spanner/instance_admin_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ inline namespace SPANNER_CLIENT_NS {
* [spanner-doc-link]:
* https://cloud.google.com/spanner/docs/api-libraries-overview
*/
class InstanceAdminClient {
class GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("InstanceAdminClient")
InstanceAdminClient {
public:
explicit InstanceAdminClient(std::shared_ptr<InstanceAdminConnection> conn)
: conn_(std::move(conn)) {}
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/instance_admin_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/instance_admin_client.h"
#include "google/cloud/spanner/mocks/mock_instance_admin_connection.h"
#include "google/cloud/testing_util/status_matchers.h"
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/instance_admin_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/instance_admin_connection.h"
#include "google/cloud/spanner/instance.h"
#include "google/cloud/spanner/internal/defaults.h"
Expand Down
6 changes: 5 additions & 1 deletion google/cloud/spanner/instance_admin_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ using ListInstanceConfigsRange = ::google::cloud::internal::PaginationRange<
* To create a concrete instance that connects you to a real Cloud Spanner
* instance administration service, see `MakeInstanceAdminConnection()`.
*/
class InstanceAdminConnection {
class GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("InstanceAdminConnection")
InstanceAdminConnection {
public:
virtual ~InstanceAdminConnection() = 0;

Expand Down Expand Up @@ -219,6 +220,7 @@ class InstanceAdminConnection {
* @param opts (optional) configure the `InstanceAdminConnection` created by
* this function.
*/
GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("MakeInstanceAdminConnection()")
std::shared_ptr<spanner::InstanceAdminConnection> MakeInstanceAdminConnection(
Options opts = {});

Expand All @@ -237,6 +239,7 @@ std::shared_ptr<spanner::InstanceAdminConnection> MakeInstanceAdminConnection(
* @param options configure the `InstanceAdminConnection` created by this
* function.
*/
GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("MakeInstanceAdminConnection()")
std::shared_ptr<InstanceAdminConnection> MakeInstanceAdminConnection(
ConnectionOptions const& options);

Expand All @@ -262,6 +265,7 @@ std::shared_ptr<InstanceAdminConnection> MakeInstanceAdminConnection(
* @par Example
* @snippet samples.cc custom-instance-admin-policies
*/
GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED("MakeInstanceAdminConnection()")
std::shared_ptr<InstanceAdminConnection> MakeInstanceAdminConnection(
ConnectionOptions const& options, std::unique_ptr<RetryPolicy> retry_policy,
std::unique_ptr<BackoffPolicy> backoff_policy,
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner/instance_admin_connection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/instance_admin_connection.h"
#include "google/cloud/spanner/create_instance_request_builder.h"
#include "google/cloud/spanner/internal/defaults.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/client.h"
#include "google/cloud/spanner/database_admin_client.h"
#include "google/cloud/spanner/instance_admin_client.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "google/cloud/spanner/client.h"
#include "google/cloud/spanner/database.h"
#include "google/cloud/spanner/database_admin_client.h"
#include "google/cloud/spanner/mutations.h"
#include "google/cloud/spanner/testing/database_integration_test.h"
#include "google/cloud/internal/getenv.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "google/cloud/spanner/client.h"
#include "google/cloud/spanner/database.h"
#include "google/cloud/spanner/database_admin_client.h"
#include "google/cloud/spanner/mutations.h"
#include "google/cloud/spanner/testing/database_integration_test.h"
#include "google/cloud/spanner/timestamp.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/database.h"
#include "google/cloud/spanner/database_admin_client.h"
#include "google/cloud/spanner/testing/instance_location.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO(#7356): Remove this file after the deprecation period expires
#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "google/cloud/spanner/create_instance_request_builder.h"
#include "google/cloud/spanner/instance_admin_client.h"
#include "google/cloud/spanner/testing/cleanup_stale_instances.h"
Expand Down
8 changes: 8 additions & 0 deletions google/cloud/spanner/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_VERSION_H

#include "google/cloud/spanner/version_info.h"
#include "google/cloud/internal/attributes.h"
#include "google/cloud/version.h"
#include <string>

#define GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED(name) \
GOOGLE_CLOUD_CPP_DEPRECATED( \
"google::cloud::spanner::" name \
" is deprecated, and will be removed on or shortly after 2022-10-01." \
" Please use google::cloud::spanner_admin::" name \
" instead. See GitHub issue #7356 for more information.")

#define SPANNER_CLIENT_NS GOOGLE_CLOUD_CPP_NS

namespace google {
Expand Down

0 comments on commit 721d690

Please sign in to comment.