From 405de7ac72dff41a7df1725931454e204a30f6aa Mon Sep 17 00:00:00 2001 From: Cheng-Yu Chung Date: Fri, 18 Nov 2022 13:22:55 -0500 Subject: [PATCH] Remove `include/grpcpp/impl/codegen/status.h` (#31285) * Remove `include/grpcpp/impl/codegen/status.h` * Include removing status_code_enum * Update * Update * Update zlib (#31356) (#31357) To mitigate CVE-2022-37434 * Update Co-authored-by: Mikhail Lappo --- BUILD | 1 + CMakeLists.txt | 2 + build_autogenerated.yaml | 2 + gRPC-C++.podspec | 1 + include/grpcpp/impl/codegen/status.h | 120 +-------------- .../grpcpp/impl/codegen/status_code_enum.h | 122 +-------------- include/grpcpp/impl/status.h | 141 ++++++++++++++++++ include/grpcpp/security/alts_util.h | 2 +- include/grpcpp/support/status.h | 2 +- include/grpcpp/support/status_code_enum.h | 123 ++++++++++++++- src/compiler/cpp_generator.cc | 2 +- test/cpp/codegen/compiler_test_golden | 2 +- tools/doxygen/Doxyfile.c++ | 1 + tools/doxygen/Doxyfile.c++.internal | 1 + 14 files changed, 280 insertions(+), 242 deletions(-) create mode 100644 include/grpcpp/impl/status.h diff --git a/BUILD b/BUILD index d8b99aa87ce..773ad1ace1a 100644 --- a/BUILD +++ b/BUILD @@ -351,6 +351,7 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpcpp/impl/server_builder_plugin.h", "include/grpcpp/impl/server_initializer.h", "include/grpcpp/impl/service_type.h", + "include/grpcpp/impl/status.h", "include/grpcpp/resource_quota.h", "include/grpcpp/security/auth_context.h", "include/grpcpp/security/auth_metadata_processor.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b72b1dfdd9..f257cd9ad06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3455,6 +3455,7 @@ foreach(_hdr include/grpcpp/impl/server_builder_plugin.h include/grpcpp/impl/server_initializer.h include/grpcpp/impl/service_type.h + include/grpcpp/impl/status.h include/grpcpp/resource_quota.h include/grpcpp/security/auth_context.h include/grpcpp/security/auth_metadata_processor.h @@ -4141,6 +4142,7 @@ foreach(_hdr include/grpcpp/impl/server_builder_plugin.h include/grpcpp/impl/server_initializer.h include/grpcpp/impl/service_type.h + include/grpcpp/impl/status.h include/grpcpp/resource_quota.h include/grpcpp/security/auth_context.h include/grpcpp/security/auth_metadata_processor.h diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 76123f7fad9..96b6968afe7 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -2830,6 +2830,7 @@ libs: - include/grpcpp/impl/server_builder_plugin.h - include/grpcpp/impl/server_initializer.h - include/grpcpp/impl/service_type.h + - include/grpcpp/impl/status.h - include/grpcpp/resource_quota.h - include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_metadata_processor.h @@ -3247,6 +3248,7 @@ libs: - include/grpcpp/impl/server_builder_plugin.h - include/grpcpp/impl/server_initializer.h - include/grpcpp/impl/service_type.h + - include/grpcpp/impl/status.h - include/grpcpp/resource_quota.h - include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_metadata_processor.h diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 55b6b4b285d..46c89e6c1d9 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -156,6 +156,7 @@ Pod::Spec.new do |s| 'include/grpcpp/impl/server_builder_plugin.h', 'include/grpcpp/impl/server_initializer.h', 'include/grpcpp/impl/service_type.h', + 'include/grpcpp/impl/status.h', 'include/grpcpp/resource_quota.h', 'include/grpcpp/security/auth_context.h', 'include/grpcpp/security/auth_metadata_processor.h', diff --git a/include/grpcpp/impl/codegen/status.h b/include/grpcpp/impl/codegen/status.h index cc8d3cdb712..7c302568e18 100644 --- a/include/grpcpp/impl/codegen/status.h +++ b/include/grpcpp/impl/codegen/status.h @@ -19,123 +19,9 @@ #ifndef GRPCPP_IMPL_CODEGEN_STATUS_H #define GRPCPP_IMPL_CODEGEN_STATUS_H -// IWYU pragma: private, include +// IWYU pragma: private -#include - -#include -#include -#include - -namespace grpc { - -/// Did it work? If it didn't, why? -/// -/// See \a grpc::StatusCode for details on the available code and their meaning. -class GRPC_MUST_USE_RESULT_WHEN_USE_STRICT_WARNING Status { - public: - /// Construct an OK instance. - Status() : code_(StatusCode::OK) { - // Static assertions to make sure that the C++ API value correctly - // maps to the core surface API value - static_assert(StatusCode::OK == static_cast(GRPC_STATUS_OK), - "Mismatched status code"); - static_assert( - StatusCode::CANCELLED == static_cast(GRPC_STATUS_CANCELLED), - "Mismatched status code"); - static_assert( - StatusCode::UNKNOWN == static_cast(GRPC_STATUS_UNKNOWN), - "Mismatched status code"); - static_assert(StatusCode::INVALID_ARGUMENT == - static_cast(GRPC_STATUS_INVALID_ARGUMENT), - "Mismatched status code"); - static_assert(StatusCode::DEADLINE_EXCEEDED == - static_cast(GRPC_STATUS_DEADLINE_EXCEEDED), - "Mismatched status code"); - static_assert( - StatusCode::NOT_FOUND == static_cast(GRPC_STATUS_NOT_FOUND), - "Mismatched status code"); - static_assert(StatusCode::ALREADY_EXISTS == - static_cast(GRPC_STATUS_ALREADY_EXISTS), - "Mismatched status code"); - static_assert(StatusCode::PERMISSION_DENIED == - static_cast(GRPC_STATUS_PERMISSION_DENIED), - "Mismatched status code"); - static_assert(StatusCode::UNAUTHENTICATED == - static_cast(GRPC_STATUS_UNAUTHENTICATED), - "Mismatched status code"); - static_assert(StatusCode::RESOURCE_EXHAUSTED == - static_cast(GRPC_STATUS_RESOURCE_EXHAUSTED), - "Mismatched status code"); - static_assert(StatusCode::FAILED_PRECONDITION == - static_cast(GRPC_STATUS_FAILED_PRECONDITION), - "Mismatched status code"); - static_assert( - StatusCode::ABORTED == static_cast(GRPC_STATUS_ABORTED), - "Mismatched status code"); - static_assert(StatusCode::OUT_OF_RANGE == - static_cast(GRPC_STATUS_OUT_OF_RANGE), - "Mismatched status code"); - static_assert(StatusCode::UNIMPLEMENTED == - static_cast(GRPC_STATUS_UNIMPLEMENTED), - "Mismatched status code"); - static_assert( - StatusCode::INTERNAL == static_cast(GRPC_STATUS_INTERNAL), - "Mismatched status code"); - static_assert(StatusCode::UNAVAILABLE == - static_cast(GRPC_STATUS_UNAVAILABLE), - "Mismatched status code"); - static_assert( - StatusCode::DATA_LOSS == static_cast(GRPC_STATUS_DATA_LOSS), - "Mismatched status code"); - } - - /// Construct an instance with associated \a code and \a error_message. - /// It is an error to construct an OK status with non-empty \a error_message. - /// Note that \a message is intentionally accepted as a const reference - /// instead of a value (which results in a copy instead of a move) to allow - /// for easy transition to absl::Status in the future which accepts an - /// absl::string_view as a parameter. - Status(StatusCode code, const std::string& error_message) - : code_(code), error_message_(error_message) {} - - /// Construct an instance with \a code, \a error_message and - /// \a error_details. It is an error to construct an OK status with non-empty - /// \a error_message and/or \a error_details. - Status(StatusCode code, const std::string& error_message, - const std::string& error_details) - : code_(code), - error_message_(error_message), - binary_error_details_(error_details) {} - - // Pre-defined special status objects. - /// An OK pre-defined instance. - static const Status& OK; - /// A CANCELLED pre-defined instance. - static const Status& CANCELLED; - - /// Return the instance's error code. - StatusCode error_code() const { return code_; } - /// Return the instance's error message. - std::string error_message() const { return error_message_; } - /// Return the (binary) error details. - // Usually it contains a serialized google.rpc.Status proto. - std::string error_details() const { return binary_error_details_; } - - /// Is the status OK? - bool ok() const { return code_ == StatusCode::OK; } - - // Ignores any errors. This method does nothing except potentially suppress - // complaints from any tools that are checking that errors are not dropped on - // the floor. - void IgnoreError() const {} - - private: - StatusCode code_; - std::string error_message_; - std::string binary_error_details_; -}; - -} // namespace grpc +/// TODO(chengyuc): Remove this file after solving compatibility. +#include #endif // GRPCPP_IMPL_CODEGEN_STATUS_H diff --git a/include/grpcpp/impl/codegen/status_code_enum.h b/include/grpcpp/impl/codegen/status_code_enum.h index 6950eab57d5..0d47f3b0330 100644 --- a/include/grpcpp/impl/codegen/status_code_enum.h +++ b/include/grpcpp/impl/codegen/status_code_enum.h @@ -21,125 +21,7 @@ // IWYU pragma: private, include -namespace grpc { - -enum StatusCode { - /// Not an error; returned on success. - OK = 0, - - /// The operation was cancelled (typically by the caller). - CANCELLED = 1, - - /// Unknown error. An example of where this error may be returned is if a - /// Status value received from another address space belongs to an error-space - /// that is not known in this address space. Also errors raised by APIs that - /// do not return enough error information may be converted to this error. - UNKNOWN = 2, - - /// Client specified an invalid argument. Note that this differs from - /// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are - /// problematic regardless of the state of the system (e.g., a malformed file - /// name). - INVALID_ARGUMENT = 3, - - /// Deadline expired before operation could complete. For operations that - /// change the state of the system, this error may be returned even if the - /// operation has completed successfully. For example, a successful response - /// from a server could have been delayed long enough for the deadline to - /// expire. - DEADLINE_EXCEEDED = 4, - - /// Some requested entity (e.g., file or directory) was not found. - NOT_FOUND = 5, - - /// Some entity that we attempted to create (e.g., file or directory) already - /// exists. - ALREADY_EXISTS = 6, - - /// The caller does not have permission to execute the specified operation. - /// PERMISSION_DENIED must not be used for rejections caused by exhausting - /// some resource (use RESOURCE_EXHAUSTED instead for those errors). - /// PERMISSION_DENIED must not be used if the caller can not be identified - /// (use UNAUTHENTICATED instead for those errors). - PERMISSION_DENIED = 7, - - /// The request does not have valid authentication credentials for the - /// operation. - UNAUTHENTICATED = 16, - - /// Some resource has been exhausted, perhaps a per-user quota, or perhaps the - /// entire file system is out of space. - RESOURCE_EXHAUSTED = 8, - - /// Operation was rejected because the system is not in a state required for - /// the operation's execution. For example, directory to be deleted may be - /// non-empty, an rmdir operation is applied to a non-directory, etc. - /// - /// A litmus test that may help a service implementor in deciding - /// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - /// (a) Use UNAVAILABLE if the client can retry just the failing call. - /// (b) Use ABORTED if the client should retry at a higher-level - /// (e.g., restarting a read-modify-write sequence). - /// (c) Use FAILED_PRECONDITION if the client should not retry until - /// the system state has been explicitly fixed. E.g., if an "rmdir" - /// fails because the directory is non-empty, FAILED_PRECONDITION - /// should be returned since the client should not retry unless - /// they have first fixed up the directory by deleting files from it. - /// (d) Use FAILED_PRECONDITION if the client performs conditional - /// REST Get/Update/Delete on a resource and the resource on the - /// server does not match the condition. E.g., conflicting - /// read-modify-write on the same resource. - FAILED_PRECONDITION = 9, - - /// The operation was aborted, typically due to a concurrency issue like - /// sequencer check failures, transaction aborts, etc. - /// - /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - /// and UNAVAILABLE. - ABORTED = 10, - - /// Operation was attempted past the valid range. E.g., seeking or reading - /// past end of file. - /// - /// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed - /// if the system state changes. For example, a 32-bit file system will - /// generate INVALID_ARGUMENT if asked to read at an offset that is not in the - /// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from - /// an offset past the current file size. - /// - /// There is a fair bit of overlap between FAILED_PRECONDITION and - /// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) - /// when it applies so that callers who are iterating through a space can - /// easily look for an OUT_OF_RANGE error to detect when they are done. - OUT_OF_RANGE = 11, - - /// Operation is not implemented or not supported/enabled in this service. - UNIMPLEMENTED = 12, - - /// Internal errors. Means some invariants expected by underlying System has - /// been broken. If you see one of these errors, Something is very broken. - INTERNAL = 13, - - /// The service is currently unavailable. This is a most likely a transient - /// condition and may be corrected by retrying with a backoff. Note that it is - /// not always safe to retry non-idempotent operations. - /// - /// \warning Although data MIGHT not have been transmitted when this - /// status occurs, there is NOT A GUARANTEE that the server has not seen - /// anything. So in general it is unsafe to retry on this status code - /// if the call is non-idempotent. - /// - /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - /// and UNAVAILABLE. - UNAVAILABLE = 14, - - /// Unrecoverable data loss or corruption. - DATA_LOSS = 15, - - /// Force users to include a default branch: - DO_NOT_USE = -1 -}; - -} // namespace grpc +/// TODO(chengyuc): Remove this file after solving compatibility. +#include #endif // GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H diff --git a/include/grpcpp/impl/status.h b/include/grpcpp/impl/status.h new file mode 100644 index 00000000000..84cbe4fe2e0 --- /dev/null +++ b/include/grpcpp/impl/status.h @@ -0,0 +1,141 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_STATUS_H +#define GRPCPP_IMPL_STATUS_H + +// IWYU pragma: private, include + +#include + +#include +#include +#include + +namespace grpc { + +/// Did it work? If it didn't, why? +/// +/// See \a grpc::StatusCode for details on the available code and their meaning. +class GRPC_MUST_USE_RESULT_WHEN_USE_STRICT_WARNING Status { + public: + /// Construct an OK instance. + Status() : code_(StatusCode::OK) { + // Static assertions to make sure that the C++ API value correctly + // maps to the core surface API value + static_assert(StatusCode::OK == static_cast(GRPC_STATUS_OK), + "Mismatched status code"); + static_assert( + StatusCode::CANCELLED == static_cast(GRPC_STATUS_CANCELLED), + "Mismatched status code"); + static_assert( + StatusCode::UNKNOWN == static_cast(GRPC_STATUS_UNKNOWN), + "Mismatched status code"); + static_assert(StatusCode::INVALID_ARGUMENT == + static_cast(GRPC_STATUS_INVALID_ARGUMENT), + "Mismatched status code"); + static_assert(StatusCode::DEADLINE_EXCEEDED == + static_cast(GRPC_STATUS_DEADLINE_EXCEEDED), + "Mismatched status code"); + static_assert( + StatusCode::NOT_FOUND == static_cast(GRPC_STATUS_NOT_FOUND), + "Mismatched status code"); + static_assert(StatusCode::ALREADY_EXISTS == + static_cast(GRPC_STATUS_ALREADY_EXISTS), + "Mismatched status code"); + static_assert(StatusCode::PERMISSION_DENIED == + static_cast(GRPC_STATUS_PERMISSION_DENIED), + "Mismatched status code"); + static_assert(StatusCode::UNAUTHENTICATED == + static_cast(GRPC_STATUS_UNAUTHENTICATED), + "Mismatched status code"); + static_assert(StatusCode::RESOURCE_EXHAUSTED == + static_cast(GRPC_STATUS_RESOURCE_EXHAUSTED), + "Mismatched status code"); + static_assert(StatusCode::FAILED_PRECONDITION == + static_cast(GRPC_STATUS_FAILED_PRECONDITION), + "Mismatched status code"); + static_assert( + StatusCode::ABORTED == static_cast(GRPC_STATUS_ABORTED), + "Mismatched status code"); + static_assert(StatusCode::OUT_OF_RANGE == + static_cast(GRPC_STATUS_OUT_OF_RANGE), + "Mismatched status code"); + static_assert(StatusCode::UNIMPLEMENTED == + static_cast(GRPC_STATUS_UNIMPLEMENTED), + "Mismatched status code"); + static_assert( + StatusCode::INTERNAL == static_cast(GRPC_STATUS_INTERNAL), + "Mismatched status code"); + static_assert(StatusCode::UNAVAILABLE == + static_cast(GRPC_STATUS_UNAVAILABLE), + "Mismatched status code"); + static_assert( + StatusCode::DATA_LOSS == static_cast(GRPC_STATUS_DATA_LOSS), + "Mismatched status code"); + } + + /// Construct an instance with associated \a code and \a error_message. + /// It is an error to construct an OK status with non-empty \a error_message. + /// Note that \a message is intentionally accepted as a const reference + /// instead of a value (which results in a copy instead of a move) to allow + /// for easy transition to absl::Status in the future which accepts an + /// absl::string_view as a parameter. + Status(StatusCode code, const std::string& error_message) + : code_(code), error_message_(error_message) {} + + /// Construct an instance with \a code, \a error_message and + /// \a error_details. It is an error to construct an OK status with non-empty + /// \a error_message and/or \a error_details. + Status(StatusCode code, const std::string& error_message, + const std::string& error_details) + : code_(code), + error_message_(error_message), + binary_error_details_(error_details) {} + + // Pre-defined special status objects. + /// An OK pre-defined instance. + static const Status& OK; + /// A CANCELLED pre-defined instance. + static const Status& CANCELLED; + + /// Return the instance's error code. + StatusCode error_code() const { return code_; } + /// Return the instance's error message. + std::string error_message() const { return error_message_; } + /// Return the (binary) error details. + // Usually it contains a serialized google.rpc.Status proto. + std::string error_details() const { return binary_error_details_; } + + /// Is the status OK? + bool ok() const { return code_ == StatusCode::OK; } + + // Ignores any errors. This method does nothing except potentially suppress + // complaints from any tools that are checking that errors are not dropped on + // the floor. + void IgnoreError() const {} + + private: + StatusCode code_; + std::string error_message_; + std::string binary_error_details_; +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_STATUS_H diff --git a/include/grpcpp/security/alts_util.h b/include/grpcpp/security/alts_util.h index b0ef4b4d9e4..5c8cfcee4b8 100644 --- a/include/grpcpp/security/alts_util.h +++ b/include/grpcpp/security/alts_util.h @@ -22,9 +22,9 @@ #include #include -#include #include #include +#include struct grpc_gcp_AltsContext; diff --git a/include/grpcpp/support/status.h b/include/grpcpp/support/status.h index e46b46d16f9..23d3a7bc555 100644 --- a/include/grpcpp/support/status.h +++ b/include/grpcpp/support/status.h @@ -19,6 +19,6 @@ #ifndef GRPCPP_SUPPORT_STATUS_H #define GRPCPP_SUPPORT_STATUS_H -#include // IWYU pragma: export +#include // IWYU pragma: export #endif // GRPCPP_SUPPORT_STATUS_H diff --git a/include/grpcpp/support/status_code_enum.h b/include/grpcpp/support/status_code_enum.h index eac697f45a1..a1b46dcd561 100644 --- a/include/grpcpp/support/status_code_enum.h +++ b/include/grpcpp/support/status_code_enum.h @@ -19,6 +19,127 @@ #ifndef GRPCPP_SUPPORT_STATUS_CODE_ENUM_H #define GRPCPP_SUPPORT_STATUS_CODE_ENUM_H -#include // IWYU pragma: export +// IWYU pragma: private, include + +namespace grpc { + +enum StatusCode { + /// Not an error; returned on success. + OK = 0, + + /// The operation was cancelled (typically by the caller). + CANCELLED = 1, + + /// Unknown error. An example of where this error may be returned is if a + /// Status value received from another address space belongs to an error-space + /// that is not known in this address space. Also errors raised by APIs that + /// do not return enough error information may be converted to this error. + UNKNOWN = 2, + + /// Client specified an invalid argument. Note that this differs from + /// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are + /// problematic regardless of the state of the system (e.g., a malformed file + /// name). + INVALID_ARGUMENT = 3, + + /// Deadline expired before operation could complete. For operations that + /// change the state of the system, this error may be returned even if the + /// operation has completed successfully. For example, a successful response + /// from a server could have been delayed long enough for the deadline to + /// expire. + DEADLINE_EXCEEDED = 4, + + /// Some requested entity (e.g., file or directory) was not found. + NOT_FOUND = 5, + + /// Some entity that we attempted to create (e.g., file or directory) already + /// exists. + ALREADY_EXISTS = 6, + + /// The caller does not have permission to execute the specified operation. + /// PERMISSION_DENIED must not be used for rejections caused by exhausting + /// some resource (use RESOURCE_EXHAUSTED instead for those errors). + /// PERMISSION_DENIED must not be used if the caller can not be identified + /// (use UNAUTHENTICATED instead for those errors). + PERMISSION_DENIED = 7, + + /// The request does not have valid authentication credentials for the + /// operation. + UNAUTHENTICATED = 16, + + /// Some resource has been exhausted, perhaps a per-user quota, or perhaps the + /// entire file system is out of space. + RESOURCE_EXHAUSTED = 8, + + /// Operation was rejected because the system is not in a state required for + /// the operation's execution. For example, directory to be deleted may be + /// non-empty, an rmdir operation is applied to a non-directory, etc. + /// + /// A litmus test that may help a service implementor in deciding + /// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + /// (a) Use UNAVAILABLE if the client can retry just the failing call. + /// (b) Use ABORTED if the client should retry at a higher-level + /// (e.g., restarting a read-modify-write sequence). + /// (c) Use FAILED_PRECONDITION if the client should not retry until + /// the system state has been explicitly fixed. E.g., if an "rmdir" + /// fails because the directory is non-empty, FAILED_PRECONDITION + /// should be returned since the client should not retry unless + /// they have first fixed up the directory by deleting files from it. + /// (d) Use FAILED_PRECONDITION if the client performs conditional + /// REST Get/Update/Delete on a resource and the resource on the + /// server does not match the condition. E.g., conflicting + /// read-modify-write on the same resource. + FAILED_PRECONDITION = 9, + + /// The operation was aborted, typically due to a concurrency issue like + /// sequencer check failures, transaction aborts, etc. + /// + /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + /// and UNAVAILABLE. + ABORTED = 10, + + /// Operation was attempted past the valid range. E.g., seeking or reading + /// past end of file. + /// + /// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed + /// if the system state changes. For example, a 32-bit file system will + /// generate INVALID_ARGUMENT if asked to read at an offset that is not in the + /// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from + /// an offset past the current file size. + /// + /// There is a fair bit of overlap between FAILED_PRECONDITION and + /// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) + /// when it applies so that callers who are iterating through a space can + /// easily look for an OUT_OF_RANGE error to detect when they are done. + OUT_OF_RANGE = 11, + + /// Operation is not implemented or not supported/enabled in this service. + UNIMPLEMENTED = 12, + + /// Internal errors. Means some invariants expected by underlying System has + /// been broken. If you see one of these errors, Something is very broken. + INTERNAL = 13, + + /// The service is currently unavailable. This is a most likely a transient + /// condition and may be corrected by retrying with a backoff. Note that it is + /// not always safe to retry non-idempotent operations. + /// + /// \warning Although data MIGHT not have been transmitted when this + /// status occurs, there is NOT A GUARANTEE that the server has not seen + /// anything. So in general it is unsafe to retry on this status code + /// if the call is non-idempotent. + /// + /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + /// and UNAVAILABLE. + UNAVAILABLE = 14, + + /// Unrecoverable data loss or corruption. + DATA_LOSS = 15, + + /// Force users to include a default branch: + DO_NOT_USE = -1 +}; + +} // namespace grpc #endif // GRPCPP_SUPPORT_STATUS_CODE_ENUM_H diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 0112285fb9b..7ebf888f873 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -151,7 +151,7 @@ std::string GetHeaderIncludes(grpc_generator::File* file, "grpcpp/impl/codegen/server_callback_handlers.h", "grpcpp/server_context.h", "grpcpp/impl/service_type.h", - "grpcpp/impl/codegen/status.h", + "grpcpp/support/status.h", "grpcpp/support/stub_options.h", "grpcpp/support/sync_stream.h", }; diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden index 7976e12433f..ef3ebff79e4 100644 --- a/test/cpp/codegen/compiler_test_golden +++ b/test/cpp/codegen/compiler_test_golden @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 5e05ee075ea..314e5d2438b 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -1020,6 +1020,7 @@ include/grpcpp/impl/server_builder_option.h \ include/grpcpp/impl/server_builder_plugin.h \ include/grpcpp/impl/server_initializer.h \ include/grpcpp/impl/service_type.h \ +include/grpcpp/impl/status.h \ include/grpcpp/resource_quota.h \ include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_metadata_processor.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index c8f209cc20c..7561bd7a01b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1020,6 +1020,7 @@ include/grpcpp/impl/server_builder_option.h \ include/grpcpp/impl/server_builder_plugin.h \ include/grpcpp/impl/server_initializer.h \ include/grpcpp/impl/service_type.h \ +include/grpcpp/impl/status.h \ include/grpcpp/resource_quota.h \ include/grpcpp/security/auth_context.h \ include/grpcpp/security/auth_metadata_processor.h \