aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-06-16 13:12:33 -0700
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-06-16 13:12:33 -0700
commit32f020ae2a4c01eba236b3a93251ef9c18f606ec (patch)
tree8d4a5bd9906729838587bb8d28c8bb0ce260da7a /include
parent7d7e640b23a1d261d4ae64505b186dabf5204ba7 (diff)
parentc1a2c314fb45dafe73b01db23944503cf8961330 (diff)
Merge pull request #2079 from yang-g/statusChange
Update the Status API
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/async_unary_call.h4
-rw-r--r--include/grpc++/client_context.h2
-rw-r--r--include/grpc++/impl/client_unary_call.h2
-rw-r--r--include/grpc++/impl/service_type.h2
-rw-r--r--include/grpc++/status.h9
-rw-r--r--include/grpc++/stream.h4
6 files changed, 11 insertions, 12 deletions
diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h
index 786f8c7184..abb6308782 100644
--- a/include/grpc++/async_unary_call.h
+++ b/include/grpc++/async_unary_call.h
@@ -117,7 +117,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
ctx_->sent_initial_metadata_ = true;
}
// The response is dropped if the status is not OK.
- if (status.IsOk()) {
+ if (status.ok()) {
finish_buf_.AddSendMessage(msg);
}
finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status);
@@ -125,7 +125,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
}
void FinishWithError(const Status& status, void* tag) {
- GPR_ASSERT(!status.IsOk());
+ GPR_ASSERT(!status.ok());
finish_buf_.Reset(tag);
if (!ctx_->sent_initial_metadata_) {
finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_);
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h
index 6d9015f278..ecf4cc7f7b 100644
--- a/include/grpc++/client_context.h
+++ b/include/grpc++/client_context.h
@@ -41,6 +41,7 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpc++/config.h>
+#include <grpc++/status.h>
#include <grpc++/time.h>
struct grpc_call;
@@ -53,7 +54,6 @@ class ChannelInterface;
class CompletionQueue;
class Credentials;
class RpcMethod;
-class Status;
template <class R>
class ClientReader;
template <class W>
diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h
index 0e8aeed781..2f234fd3ac 100644
--- a/include/grpc++/impl/client_unary_call.h
+++ b/include/grpc++/impl/client_unary_call.h
@@ -35,6 +35,7 @@
#define GRPCXX_IMPL_CLIENT_UNARY_CALL_H
#include <grpc++/config.h>
+#include <grpc++/status.h>
namespace grpc {
@@ -42,7 +43,6 @@ class ChannelInterface;
class ClientContext;
class CompletionQueue;
class RpcMethod;
-class Status;
// Wrapper that performs a blocking unary call
Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h
index bc39bb82ac..25e437edad 100644
--- a/include/grpc++/impl/service_type.h
+++ b/include/grpc++/impl/service_type.h
@@ -35,6 +35,7 @@
#define GRPCXX_IMPL_SERVICE_TYPE_H
#include <grpc++/config.h>
+#include <grpc++/status.h>
namespace grpc {
@@ -44,7 +45,6 @@ class RpcService;
class Server;
class ServerCompletionQueue;
class ServerContext;
-class Status;
class SynchronousService {
public:
diff --git a/include/grpc++/status.h b/include/grpc++/status.h
index 8073319eab..fb8526ddce 100644
--- a/include/grpc++/status.h
+++ b/include/grpc++/status.h
@@ -42,18 +42,17 @@ namespace grpc {
class Status {
public:
Status() : code_(StatusCode::OK) {}
- explicit Status(StatusCode code) : code_(code) {}
Status(StatusCode code, const grpc::string& details)
: code_(code), details_(details) {}
// Pre-defined special status objects.
static const Status& OK;
- static const Status& Cancelled;
+ static const Status& CANCELLED;
- StatusCode code() const { return code_; }
- grpc::string details() const { return details_; }
+ StatusCode error_code() const { return code_; }
+ grpc::string error_message() const { return details_; }
- bool IsOk() const { return code_ == StatusCode::OK; }
+ bool ok() const { return code_ == StatusCode::OK; }
private:
StatusCode code_;
diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h
index c836f98c2a..472911e62b 100644
--- a/include/grpc++/stream.h
+++ b/include/grpc++/stream.h
@@ -615,7 +615,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
ctx_->sent_initial_metadata_ = true;
}
// The response is dropped if the status is not OK.
- if (status.IsOk()) {
+ if (status.ok()) {
finish_buf_.AddSendMessage(msg);
}
finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status);
@@ -623,7 +623,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
}
void FinishWithError(const Status& status, void* tag) {
- GPR_ASSERT(!status.IsOk());
+ GPR_ASSERT(!status.ok());
finish_buf_.Reset(tag);
if (!ctx_->sent_initial_metadata_) {
finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_);