diff options
author | Craig Tiller <ctiller@google.com> | 2015-06-19 15:37:43 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-06-19 15:37:43 -0700 |
commit | 85207d5a25d90ef001d63b7fac127132d85bc59e (patch) | |
tree | bc1482f4de79bcd04c50963d41fadb68d6518659 /include/grpc++ | |
parent | 4efb6966bdfb62c725c6614b0d85ea374250bb51 (diff) | |
parent | f3fac562e8994631484f77ad8b0c6c17582699a8 (diff) |
Merge github.com:grpc/grpc into flow-like-lava-to-a-barnyard
Diffstat (limited to 'include/grpc++')
-rw-r--r-- | include/grpc++/async_unary_call.h | 4 | ||||
-rw-r--r-- | include/grpc++/byte_buffer.h | 1 | ||||
-rw-r--r-- | include/grpc++/channel_arguments.h | 4 | ||||
-rw-r--r-- | include/grpc++/client_context.h | 2 | ||||
-rw-r--r-- | include/grpc++/config.h | 24 | ||||
-rw-r--r-- | include/grpc++/impl/client_unary_call.h | 2 | ||||
-rw-r--r-- | include/grpc++/impl/service_type.h | 2 | ||||
-rw-r--r-- | include/grpc++/status.h | 9 | ||||
-rw-r--r-- | include/grpc++/stream.h | 4 | ||||
-rw-r--r-- | include/grpc++/time.h | 16 |
10 files changed, 40 insertions, 28 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++/byte_buffer.h b/include/grpc++/byte_buffer.h index ceb62622fd..3e40eaed1d 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -35,6 +35,7 @@ #define GRPCXX_BYTE_BUFFER_H #include <grpc/grpc.h> +#include <grpc/byte_buffer.h> #include <grpc/support/log.h> #include <grpc++/config.h> #include <grpc++/slice.h> diff --git a/include/grpc++/channel_arguments.h b/include/grpc++/channel_arguments.h index 8d338c654e..68f24cde4a 100644 --- a/include/grpc++/channel_arguments.h +++ b/include/grpc++/channel_arguments.h @@ -38,6 +38,7 @@ #include <list> #include <grpc++/config.h> +#include <grpc/compression.h> #include <grpc/grpc.h> namespace grpc { @@ -58,6 +59,9 @@ class ChannelArguments { void SetSslTargetNameOverride(const grpc::string& name); // TODO(yangg) add flow control options + // Set the compression level for the channel. + void SetCompressionLevel(grpc_compression_level level); + // Generic channel argument setters. Only for advanced use cases. void SetInt(const grpc::string& key, int value); void SetString(const grpc::string& key, const grpc::string& value); 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++/config.h b/include/grpc++/config.h index 55b2a64482..ca74064be2 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -46,7 +46,7 @@ #define GRPC_CXX0X_NO_OVERRIDE 1 #define GRPC_CXX0X_NO_CHRONO 1 #define GRPC_CXX0X_NO_THREAD 1 -#endif +#endif #endif // Visual Studio #ifndef __clang__ @@ -99,24 +99,28 @@ ::google::protobuf::io::ZeroCopyOutputStream #define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ ::google::protobuf::io::ZeroCopyInputStream -#define GRPC_CUSTOM_CODEDINPUTSTREAM \ - ::google::protobuf::io::CodedInputStream +#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream #endif - #ifdef GRPC_CXX0X_NO_NULLPTR #include <memory> const class { -public: - template <class T> operator T*() const {return static_cast<T *>(0);} - template <class T> operator std::unique_ptr<T>() const { + public: + template <class T> + operator T *() const { + return static_cast<T *>(0); + } + template <class T> + operator std::unique_ptr<T>() const { return std::unique_ptr<T>(static_cast<T *>(0)); } - template <class T> operator std::shared_ptr<T>() const { + template <class T> + operator std::shared_ptr<T>() const { return std::shared_ptr<T>(static_cast<T *>(0)); } - operator bool() const {return false;} -private: + operator bool() const { return false; } + + private: void operator&() const = delete; } nullptr = {}; #endif 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_); diff --git a/include/grpc++/time.h b/include/grpc++/time.h index f9b2ce5cab..8fb2f8505c 100644 --- a/include/grpc++/time.h +++ b/include/grpc++/time.h @@ -52,22 +52,22 @@ namespace grpc { template <typename T> class TimePoint { public: - TimePoint(const T& time) { - you_need_a_specialization_of_TimePoint(); - } + TimePoint(const T& time) { you_need_a_specialization_of_TimePoint(); } gpr_timespec raw_time() { gpr_timespec t; return t; } + private: void you_need_a_specialization_of_TimePoint(); }; -template<> +template <> class TimePoint<gpr_timespec> { public: - TimePoint(const gpr_timespec& time) : time_(time) { } + TimePoint(const gpr_timespec& time) : time_(time) {} gpr_timespec raw_time() { return time_; } + private: gpr_timespec time_; }; @@ -85,6 +85,9 @@ namespace grpc { // from and to should be absolute time. void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, gpr_timespec* to); +void TimepointHR2Timespec( + const std::chrono::high_resolution_clock::time_point& from, + gpr_timespec* to); std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); @@ -92,9 +95,10 @@ template <> class TimePoint<std::chrono::system_clock::time_point> { public: TimePoint(const std::chrono::system_clock::time_point& time) { - Timepoint2Timespec(time, &time_); + Timepoint2Timespec(time, &time_); } gpr_timespec raw_time() const { return time_; } + private: gpr_timespec time_; }; |